You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/03/12 11:39:23 UTC
[05/10] jclouds-labs git commit: White noise: formatting
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
index 325c41b..2088418 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
@@ -36,44 +36,58 @@ import com.google.inject.Inject;
public class OSImageToImage implements Function<OSImage, Image> {
private static final String UNRECOGNIZED = "UNRECOGNIZED";
+
private static final String UBUNTU = "Ubuntu";
+
private static final String WINDOWS = "Windows";
+
private static final String OPENLOGIC = "openLogic";
+
private static final String CENTOS = "CentOS";
+
private static final String COREOS = "CoreOS";
+
private static final String OPENSUSE = "openSUSE";
+
private static final String SUSE = "SUSE";
+
private static final String SQL_SERVER = "SQL Server";
+
private static final String ORACLE_lINUX = "Oracle Linux";
private final JustProvider provider;
@Inject
- OSImageToImage(JustProvider provider) {
+ OSImageToImage(final JustProvider provider) {
this.provider = provider;
}
@Override
- public Image apply(OSImage image) {
-
- ImageBuilder builder = new ImageBuilder()
- .id(image.name())
- .name(image.label())
- .description(image.description())
- .status(Image.Status.AVAILABLE)
- .uri(image.mediaLink())
- .providerId(image.name())
- .location(createLocation(image.location()));
-
- OperatingSystem.Builder osBuilder = osFamily().apply(image);
+ public Image apply(final OSImage image) {
+ final ImageBuilder builder = new ImageBuilder()
+ .id(image.name())
+ .name(image.label())
+ .description(image.description())
+ .status(Image.Status.AVAILABLE)
+ .uri(image.mediaLink())
+ .providerId(image.name())
+ .location(createLocation(image.location()));
+
+ final OperatingSystem.Builder osBuilder = osFamily().apply(image);
return builder.operatingSystem(osBuilder.build()).build();
}
- private Location createLocation(String input) {
- if (input == null) return null;
- return new LocationBuilder().id(input).scope(LocationScope.REGION).description(input).parent(
- Iterables.getOnlyElement(provider.get())).metadata(ImmutableMap.<String, Object>of("name", input))
- .build();
+ private Location createLocation(final String input) {
+ if (input == null) {
+ return null;
+ }
+ return new LocationBuilder().
+ id(input).
+ scope(LocationScope.REGION).
+ description(input).
+ parent(Iterables.getOnlyElement(provider.get())).
+ metadata(ImmutableMap.<String, Object>of("name", input)).
+ build();
}
public static Function<OSImage, OperatingSystem.Builder> osFamily() {
@@ -85,47 +99,49 @@ public class OSImageToImage implements Function<OSImage, Image> {
checkNotNull(label, "label");
OsFamily family = OsFamily.UNRECOGNIZED;
- if (label.contains(CENTOS))
+ if (label.contains(CENTOS)) {
family = OsFamily.CENTOS;
- else if (label.contains(OPENLOGIC))
+ } else if (label.contains(OPENLOGIC)) {
family = OsFamily.CENTOS;
- else if (label.contains(SUSE))
+ } else if (label.contains(SUSE)) {
family = OsFamily.SUSE;
- else if (label.contains(UBUNTU))
+ } else if (label.contains(UBUNTU)) {
family = OsFamily.UBUNTU;
- else if (label.contains(WINDOWS))
+ } else if (label.contains(WINDOWS)) {
family = OsFamily.WINDOWS;
- else if (label.contains(ORACLE_lINUX))
+ } else if (label.contains(ORACLE_lINUX)) {
family = OsFamily.OEL;
+ }
String version = UNRECOGNIZED;
//ex: CoreOS Alpha -> Alpha
- if (label.contains(COREOS))
+ if (label.contains(COREOS)) {
version = label.replace("CoreOS ", "");
- //openSUSE 13.1 -> 13.1
- else if (label.contains(OPENSUSE))
+ } //openSUSE 13.1 -> 13.1
+ else if (label.contains(OPENSUSE)) {
version = label.replace("openSUSE ", "");
- //SUSE Linux Enterprise Server 11 SP3 (Premium Image) -> 11 SP3(Premium Image)
- else if (label.contains(SUSE))
+ } //SUSE Linux Enterprise Server 11 SP3 (Premium Image) -> 11 SP3(Premium Image)
+ else if (label.contains(SUSE)) {
version = label.replace("SUSE ", "");
- //Ubuntu Server 12.04 LTS -> 12.04 LTS
- else if (label.contains(UBUNTU))
+ } //Ubuntu Server 12.04 LTS -> 12.04 LTS
+ else if (label.contains(UBUNTU)) {
version = label.replace("Ubuntu Server ", "");
- else if (label.contains(SQL_SERVER))
+ } else if (label.contains(SQL_SERVER)) {
version = label;
- else if (label.contains(CENTOS))
+ } else if (label.contains(CENTOS)) {
version = label;
- else if (label.contains(WINDOWS))
+ } else if (label.contains(WINDOWS)) {
version = label;
- else if (label.equals(ORACLE_lINUX))
+ } else if (label.equals(ORACLE_lINUX)) {
version = label;
+ }
if (family != OsFamily.UNRECOGNIZED) {
return OperatingSystem.builder().family(family).version(version)
- .description(image.description() + "");
+ .description(image.description() + "");
}
if (image.os() == OSImage.Type.WINDOWS) {
return OperatingSystem.builder().family(OsFamily.WINDOWS).version(version)
- .description(image.description() + "");
+ .description(image.description() + "");
}
return OperatingSystem.builder().family(OsFamily.LINUX).version(version).description(image.description());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
index c778805..fd844c4 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
@@ -26,36 +26,38 @@ import com.google.common.collect.ImmutableList;
public class RoleSizeToHardware implements Function<RoleSize, Hardware> {
- @Override
- public Hardware apply(RoleSize from) {
- HardwareBuilder builder = new HardwareBuilder().ids(from.name().name())
- .name(from.name().name())
- .hypervisor("Hyper-V")
- .processors(ImmutableList.of(new Processor(from.cores(), 2)))
- .ram(from.memoryInMb());
+ @Override
+ public Hardware apply(RoleSize from) {
+ final HardwareBuilder builder = new HardwareBuilder().
+ ids(from.name().name()).
+ name(from.name().name()).
+ hypervisor("Hyper-V").
+ processors(ImmutableList.of(new Processor(from.cores(), 2))).
+ ram(from.memoryInMb());
- // TODO volumes
+ // TODO volumes
/*
- if (from.s() != null) {
- builder.volumes(
- FluentIterable.from(from.getVirtualGuestBlockDevices()).filter(new Predicate<VirtualGuestBlockDevice>() {
- @Override
- public boolean apply(VirtualGuestBlockDevice input) {
- return input.getMountType().equals("Disk");
- }
- })
- .transform(new Function<VirtualGuestBlockDevice, Volume>() {
- @Override
- public Volume apply(VirtualGuestBlockDevice item) {
- float volumeSize = item.getVirtualDiskImage().getCapacity();
- return new VolumeImpl(
- item.getId() + "",
- from.isLocalDiskFlag() ? Volume.Type.LOCAL : Volume.Type.SAN,
- volumeSize, null, item.getBootableFlag() == 1, false);
- }
- }).toSet());
- }
- */
- return builder.build(); }
+ * if (from.s() != null) {
+ * builder.volumes(
+ * FluentIterable.from(from.getVirtualGuestBlockDevices()).filter(new Predicate<VirtualGuestBlockDevice>() {
+ * @Override
+ * public boolean apply(VirtualGuestBlockDevice input) {
+ * return input.getMountType().equals("Disk");
+ * }
+ * })
+ * .transform(new Function<VirtualGuestBlockDevice, Volume>() {
+ * @Override
+ * public Volume apply(VirtualGuestBlockDevice item) {
+ * float volumeSize = item.getVirtualDiskImage().getCapacity();
+ * return new VolumeImpl(
+ * item.getId() + "",
+ * from.isLocalDiskFlag() ? Volume.Type.LOCAL : Volume.Type.SAN,
+ * volumeSize, null, item.getBootableFlag() == 1, false);
+ * }
+ * }).toSet());
+ * }
+ */
+ return builder.build();
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/internal/OperatingSystems.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/internal/OperatingSystems.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/internal/OperatingSystems.java
index 178d632..0cc1927 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/internal/OperatingSystems.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/internal/OperatingSystems.java
@@ -26,12 +26,19 @@ import com.google.common.collect.Iterables;
public class OperatingSystems {
protected static final String CENTOS = "CentOS";
+
protected static final String SUSE = "SUSE";
+
protected static final String OPENSUSE = "openSUSE";
+
protected static final String UBUNTU = "Ubuntu";
+
protected static final String WINDOWS = "Windows";
+
private static final String MICROSOFT = "Microsoft";
+
public static final String WINDOWS_SERVER = "Windows Server";
+
public static final String MICROSOFT_SQL_SERVER = "Microsoft SQL Server";
public static Function<String, OsFamily> osFamily() {
@@ -39,10 +46,15 @@ public class OperatingSystems {
@Override
public OsFamily apply(final String label) {
if (label != null) {
- if (label.contains(CENTOS)) return OsFamily.CENTOS;
- else if (label.contains(SUSE)) return OsFamily.SUSE;
- else if (label.contains(UBUNTU)) return OsFamily.UBUNTU;
- else if (label.contains(WINDOWS)) return OsFamily.WINDOWS;
+ if (label.contains(CENTOS)) {
+ return OsFamily.CENTOS;
+ } else if (label.contains(SUSE)) {
+ return OsFamily.SUSE;
+ } else if (label.contains(UBUNTU)) {
+ return OsFamily.UBUNTU;
+ } else if (label.contains(WINDOWS)) {
+ return OsFamily.WINDOWS;
+ }
}
return OsFamily.UNRECOGNIZED;
}
@@ -52,7 +64,7 @@ public class OperatingSystems {
public static Function<OSImage, String> version() {
return new Function<OSImage, String>() {
@Override
- public String apply(OSImage osImage) {
+ public String apply(final OSImage osImage) {
if (osImage.category().matches("Canonical|OpenLogic")) {
return Iterables.get(Splitter.on(" ").split(osImage.label()), 2);
} else if (osImage.category().matches(SUSE)) {
@@ -70,7 +82,7 @@ public class OperatingSystems {
return osImage.label().substring(MICROSOFT_SQL_SERVER.length() + 1);
}
} else if (osImage.category().matches("RightScale with Linux|Public ")) {
- Iterable<String> splittedLabel = Splitter.on("-").split(osImage.label());
+ final Iterable<String> splittedLabel = Splitter.on("-").split(osImage.label());
if (Iterables.size(splittedLabel) > 2) {
return Iterables.get(splittedLabel, 2);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes.java
index e0a5b27..3a52a5e 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes.java
@@ -21,6 +21,7 @@ import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Iterables.tryFind;
import static java.lang.String.format;
import static org.jclouds.azurecompute.compute.config.AzureComputeServiceContextModule.AzureComputeConstants;
+
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -44,7 +45,7 @@ import org.jclouds.compute.domain.Template;
import org.jclouds.compute.functions.GroupNamingConvention;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
+import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory;
import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
import org.jclouds.logging.Logger;
@@ -61,13 +62,19 @@ import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Inject;
@Singleton
-public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes extends CreateNodesWithGroupEncodedIntoNameThenAddToSet {
+public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes
+ extends CreateNodesWithGroupEncodedIntoNameThenAddToSet {
private static final String DEFAULT_STORAGE_ACCOUNT_PREFIX = "jclouds";
+
private static final String DEFAULT_STORAGE_SERVICE_TYPE = "Standard_GRS";
+
private static final String DEFAULT_VIRTUAL_NETWORK_NAME = "jclouds-virtual-network";
+
private static final String DEFAULT_ADDRESS_SPACE_ADDRESS_PREFIX = "10.0.0.0/20";
+
private static final String DEFAULT_SUBNET_NAME = "jclouds-1";
+
private static final String DEFAULT_SUBNET_ADDRESS_PREFIX = "10.0.0.0/23";
@Resource
@@ -75,7 +82,9 @@ public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes extends C
protected Logger logger = Logger.NULL;
private final AzureComputeApi api;
+
private final Predicate<String> operationSucceededPredicate;
+
private final AzureComputeConstants azureComputeConstants;
@Inject
@@ -84,73 +93,92 @@ public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes extends C
ListNodesStrategy listNodesStrategy,
GroupNamingConvention.Factory namingConvention,
@Named("jclouds.user-threads") ListeningExecutorService userExecutor,
- CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
+ Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
AzureComputeApi api,
Predicate<String> operationSucceededPredicate,
AzureComputeConstants azureComputeConstants) {
- super(addNodeWithGroupStrategy, listNodesStrategy, namingConvention, userExecutor, customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
+
+ super(addNodeWithGroupStrategy, listNodesStrategy, namingConvention, userExecutor,
+ customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
+
this.api = api;
this.operationSucceededPredicate = operationSucceededPredicate;
this.azureComputeConstants = azureComputeConstants;
}
@Override
- protected ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group, String name, Template template) {
+ protected ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(
+ final String group, final String name, final Template template) {
+
return super.createNodeInGroupWithNameAndTemplate(group, name, template);
}
@Override
- public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
-
- AzureComputeTemplateOptions templateOptions = template.getOptions().as(AzureComputeTemplateOptions.class);
- String storageAccountName = templateOptions.getStorageAccountName().or(generateStorageServiceName(DEFAULT_STORAGE_ACCOUNT_PREFIX));
- String location = template.getLocation().getId();
- String storageAccountType = templateOptions.getStorageAccountType().or(DEFAULT_STORAGE_SERVICE_TYPE);
- String virtualNetworkName = templateOptions.getVirtualNetworkName().or(DEFAULT_VIRTUAL_NETWORK_NAME);
- String subnetName = templateOptions.getSubnetName().or(DEFAULT_SUBNET_NAME);
- String addressSpaceAddressPrefix = templateOptions.getAddressSpaceAddressPrefix().or(DEFAULT_ADDRESS_SPACE_ADDRESS_PREFIX);
- String subnetAddressPrefix = templateOptions.getSubnetAddressPrefix().or(DEFAULT_SUBNET_ADDRESS_PREFIX);
- Set<String> networkSecurityGroupNames = templateOptions.getGroups().isEmpty() ? Sets.<String>newHashSet() : templateOptions.getGroups();
+ public Map<?, ListenableFuture<Void>> execute(
+ final String group, final int count, final Template template,
+ final Set<NodeMetadata> goodNodes, final Map<NodeMetadata, Exception> badNodes,
+ final Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
+
+ final AzureComputeTemplateOptions templateOptions = template.getOptions().as(AzureComputeTemplateOptions.class);
+ final String storageAccountName = templateOptions.getStorageAccountName().
+ or(generateStorageServiceName(DEFAULT_STORAGE_ACCOUNT_PREFIX));
+ final String location = template.getLocation().getId();
+ final String storageAccountType = templateOptions.getStorageAccountType().or(DEFAULT_STORAGE_SERVICE_TYPE);
+ final String virtualNetworkName = templateOptions.getVirtualNetworkName().or(DEFAULT_VIRTUAL_NETWORK_NAME);
+ final String subnetName = templateOptions.getSubnetName().or(DEFAULT_SUBNET_NAME);
+ final String addressSpaceAddressPrefix = templateOptions.getAddressSpaceAddressPrefix().
+ or(DEFAULT_ADDRESS_SPACE_ADDRESS_PREFIX);
+ final String subnetAddressPrefix = templateOptions.getSubnetAddressPrefix().or(DEFAULT_SUBNET_ADDRESS_PREFIX);
+ final Set<String> networkSecurityGroupNames = templateOptions.getGroups().isEmpty() ? Sets.<String>newHashSet() : templateOptions.getGroups();
// get or create storage service
- StorageService storageService = tryFindExistingStorageServiceAccountOrCreate(api, location, storageAccountName,
- storageAccountType);
+ final StorageService storageService = tryFindExistingStorageServiceAccountOrCreate(
+ api, location, storageAccountName, storageAccountType);
templateOptions.storageAccountName(storageService.serviceName());
// check existence or create virtual network
- checkExistingVirtualNetworkNamedOrCreate(virtualNetworkName, location, subnetName, addressSpaceAddressPrefix, subnetAddressPrefix);
+ checkExistingVirtualNetworkNamedOrCreate(
+ virtualNetworkName, location, subnetName, addressSpaceAddressPrefix, subnetAddressPrefix);
templateOptions.virtualNetworkName(virtualNetworkName);
templateOptions.subnetName(subnetName);
// add network security group to the subnet
if (!networkSecurityGroupNames.isEmpty()) {
String networkSecurityGroupName = Iterables.get(networkSecurityGroupNames, 0);
- logger.warn("Only network security group '%s' will be applied to subnet '%s'.", networkSecurityGroupName, subnetName);
- final NetworkSecurityGroup networkSecurityGroupAppliedToSubnet = api.getNetworkSecurityGroupApi().getNetworkSecurityGroupAppliedToSubnet(virtualNetworkName, subnetName);
+ logger.warn("Only network security group '%s' will be applied to subnet '%s'.",
+ networkSecurityGroupName, subnetName);
+ final NetworkSecurityGroup networkSecurityGroupAppliedToSubnet = api.getNetworkSecurityGroupApi().
+ getNetworkSecurityGroupAppliedToSubnet(virtualNetworkName, subnetName);
if (networkSecurityGroupAppliedToSubnet != null) {
if (!networkSecurityGroupAppliedToSubnet.name().equals(networkSecurityGroupName)) {
- logger.debug("Removing a networkSecurityGroup %s is already applied to subnet '%s' ...", networkSecurityGroupName, subnetName);
+ logger.debug("Removing a networkSecurityGroup %s is already applied to subnet '%s' ...",
+ networkSecurityGroupName, subnetName);
// remove existing nsg from subnet
- String removeFromSubnetRequestId = api.getNetworkSecurityGroupApi().removeFromSubnet(virtualNetworkName, subnetName, networkSecurityGroupAppliedToSubnet.name());
+ String removeFromSubnetRequestId = api.getNetworkSecurityGroupApi().
+ removeFromSubnet(virtualNetworkName, subnetName, networkSecurityGroupAppliedToSubnet.name());
if (!operationSucceededPredicate.apply(removeFromSubnetRequestId)) {
- final String warnMessage = format("Remove existing networkSecurityGroup(%s) to subnet(%s) has not been completed " +
- "within %sms.", networkSecurityGroupName, subnetName, azureComputeConstants.operationTimeout());
+ final String warnMessage = format(
+ "Remove existing networkSecurityGroup(%s) to subnet(%s) has not been completed "
+ + "within %sms.", networkSecurityGroupName, subnetName,
+ azureComputeConstants.operationTimeout());
logger.warn(warnMessage);
- String illegalStateExceptionMessage = format("%s. Please, try by increasing `%s` and try again",
+ final String illegalStateExceptionMessage = format(
+ "%s. Please, try by increasing `%s` and try again",
AzureComputeProperties.OPERATION_TIMEOUT, warnMessage);
throw new IllegalStateException(illegalStateExceptionMessage);
}
}
}
// add nsg to subnet
- logger.debug("Adding a networkSecurityGroup %s is already applied to subnet '%s' of virtual network %s ...", networkSecurityGroupName, subnetName, virtualNetworkName);
- String addToSubnetId = api.getNetworkSecurityGroupApi().addToSubnet(virtualNetworkName, subnetName,
+ logger.debug("Adding a networkSecurityGroup %s is already applied to subnet '%s' of virtual network %s ...",
+ networkSecurityGroupName, subnetName, virtualNetworkName);
+ final String addToSubnetId = api.getNetworkSecurityGroupApi().addToSubnet(virtualNetworkName, subnetName,
NetworkSecurityGroup.create(networkSecurityGroupName, null, null, null));
if (!operationSucceededPredicate.apply(addToSubnetId)) {
- final String warnMessage = format("Add networkSecurityGroup(%s) to subnet(%s) has not been completed " +
- "within %sms.", networkSecurityGroupName, subnetName, azureComputeConstants.operationTimeout());
+ final String warnMessage = format("Add networkSecurityGroup(%s) to subnet(%s) has not been completed "
+ + "within %sms.", networkSecurityGroupName, subnetName, azureComputeConstants.operationTimeout());
logger.warn(warnMessage);
- String illegalStateExceptionMessage = format("%s. Please, try by increasing `%s` and try again",
+ final String illegalStateExceptionMessage = format("%s. Please, try by increasing `%s` and try again",
AzureComputeProperties.OPERATION_TIMEOUT, warnMessage);
throw new IllegalStateException(illegalStateExceptionMessage);
}
@@ -159,20 +187,23 @@ public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes extends C
}
/**
- * Tries to find a storage service account whose name matches the regex DEFAULT_STORAGE_ACCOUNT_PREFIX+"[a-z]{10}"
- * in the location, otherwise it creates a new storage service account with name and type in the location
+ * Tries to find a storage service account whose name matches the regex DEFAULT_STORAGE_ACCOUNT_PREFIX+"[a-z]{10}" in
+ * the location, otherwise it creates a new storage service account with name and type in the location
*/
- private StorageService tryFindExistingStorageServiceAccountOrCreate(AzureComputeApi api, String location, final String name, final String type) {
+ private StorageService tryFindExistingStorageServiceAccountOrCreate(
+ final AzureComputeApi api, final String location, final String name, final String type) {
+
final List<StorageService> storageServices = api.getStorageAccountApi().list();
logger.debug("Looking for a suitable existing storage account ...");
@SuppressWarnings("unchecked")
- final Predicate<StorageService> storageServicePredicate = and(notNull(), new SameLocationAndCreatedStorageServicePredicate(location), new Predicate<StorageService>() {
- @Override
- public boolean apply(StorageService input) {
- return input.serviceName().matches(format("^%s[a-z]{10}$", DEFAULT_STORAGE_ACCOUNT_PREFIX));
- }
- });
+ final Predicate<StorageService> storageServicePredicate = and(notNull(),
+ new SameLocationAndCreatedStorageServicePredicate(location), new Predicate<StorageService>() {
+ @Override
+ public boolean apply(final StorageService input) {
+ return input.serviceName().matches(format("^%s[a-z]{10}$", DEFAULT_STORAGE_ACCOUNT_PREFIX));
+ }
+ });
final Optional<StorageService> storageServiceOptional = tryFind(storageServices, storageServicePredicate);
if (storageServiceOptional.isPresent()) {
final StorageService storageService = storageServiceOptional.get();
@@ -182,20 +213,21 @@ public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes extends C
// create
if (!checkAvailability(name)) {
logger.warn("The storage service account name %s is not available", name);
- throw new IllegalStateException(format("Can't create a valid storage account with name %s. " +
- "Please, try by choosing a different `storageAccountName` in templateOptions and try again", name));
+ throw new IllegalStateException(format("Can't create a valid storage account with name %s. "
+ + "Please, try by choosing a different `storageAccountName` in templateOptions and try again", name));
}
logger.debug("Creating a storage service account '%s' in location '%s' ...", name, location);
- String createStorateServiceRequestId = api.getStorageAccountApi().create(StorageServiceParams.builder()
+ final String createStorateServiceRequestId = api.getStorageAccountApi().create(StorageServiceParams.builder()
.name(name)
.label(name)
.location(location)
.accountType(StorageServiceParams.Type.valueOf(type))
.build());
if (!operationSucceededPredicate.apply(createStorateServiceRequestId)) {
- final String warnMessage = format("Create storage service account has not been completed within %sms.", azureComputeConstants.operationTimeout());
+ final String warnMessage = format("Create storage service account has not been completed within %sms.",
+ azureComputeConstants.operationTimeout());
logger.warn(warnMessage);
- String illegalStateExceptionMessage = format("%s. Please, try by increasing `%s` and try again",
+ final String illegalStateExceptionMessage = format("%s. Please, try by increasing `%s` and try again",
AzureComputeProperties.OPERATION_TIMEOUT, warnMessage);
throw new IllegalStateException(illegalStateExceptionMessage);
}
@@ -203,48 +235,55 @@ public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes extends C
}
}
- private void checkExistingVirtualNetworkNamedOrCreate(final String virtualNetworkName, String
- location, String subnetName, String addressSpaceAddressPrefix, String subnetAddressPrefix) {
+ private void checkExistingVirtualNetworkNamedOrCreate(
+ final String virtualNetworkName, final String location, final String subnetName,
+ final String addressSpaceAddressPrefix, final String subnetAddressPrefix) {
+
logger.debug("Looking for a virtual network named '%s' ...", virtualNetworkName);
- Optional<NetworkConfiguration.VirtualNetworkSite> networkSiteOptional = getVirtualNetworkNamed(virtualNetworkName);
- if (networkSiteOptional.isPresent()) return;
+ final Optional<NetworkConfiguration.VirtualNetworkSite> networkSiteOptional
+ = getVirtualNetworkNamed(virtualNetworkName);
+ if (networkSiteOptional.isPresent()) {
+ return;
+ }
final NetworkConfiguration networkConfiguration = NetworkConfiguration.create(
NetworkConfiguration.VirtualNetworkConfiguration.create(null,
ImmutableList.of(NetworkConfiguration.VirtualNetworkSite.create(
- UUID.randomUUID().toString(),
- virtualNetworkName,
- location,
- NetworkConfiguration.AddressSpace.create(addressSpaceAddressPrefix),
- ImmutableList.of(NetworkConfiguration.Subnet.create(subnetName, subnetAddressPrefix, null))))
+ UUID.randomUUID().toString(),
+ virtualNetworkName,
+ location,
+ NetworkConfiguration.AddressSpace.create(addressSpaceAddressPrefix),
+ ImmutableList.of(NetworkConfiguration.Subnet.create(
+ subnetName, subnetAddressPrefix, null))))
)
);
logger.debug("Creating a virtual network with configuration '%s' ...", networkConfiguration);
- String setNetworkConfigurationRequestId = api.getVirtualNetworkApi().set(networkConfiguration);
+ final String setNetworkConfigurationRequestId = api.getVirtualNetworkApi().set(networkConfiguration);
if (!operationSucceededPredicate.apply(setNetworkConfigurationRequestId)) {
final String warnMessage = format("Network configuration (%s) has not been completed within %sms.",
networkConfiguration, azureComputeConstants.operationTimeout());
logger.warn(warnMessage);
- String illegalStateExceptionMessage = format("%s. Please, try by increasing `%s` and try again",
+ final String illegalStateExceptionMessage = format("%s. Please, try by increasing `%s` and try again",
AzureComputeProperties.OPERATION_TIMEOUT, warnMessage);
throw new IllegalStateException(illegalStateExceptionMessage);
- } }
+ }
+ }
private Optional<NetworkConfiguration.VirtualNetworkSite> getVirtualNetworkNamed(final String virtualNetworkName) {
return FluentIterable.from(api.getVirtualNetworkApi().list())
.filter(new Predicate<NetworkConfiguration.VirtualNetworkSite>() {
@Override
- public boolean apply(NetworkConfiguration.VirtualNetworkSite input) {
+ public boolean apply(final NetworkConfiguration.VirtualNetworkSite input) {
return input.name().equals(virtualNetworkName);
}
})
.first();
}
- private boolean checkAvailability(String name) {
+ private boolean checkAvailability(final String name) {
return api.getStorageAccountApi().checkAvailable(name).result();
}
- private static String generateStorageServiceName(String prefix) {
+ private static String generateStorageServiceName(final String prefix) {
String characters = "abcdefghijklmnopqrstuvwxyz";
StringBuilder builder = new StringBuilder();
builder.append(prefix);
@@ -257,15 +296,17 @@ public class GetOrCreateStorageServiceAndVirtualNetworkThenCreateNodes extends C
}
private static class SameLocationAndCreatedStorageServicePredicate implements Predicate<StorageService> {
+
private final String location;
- public SameLocationAndCreatedStorageServicePredicate(String location) {
+ public SameLocationAndCreatedStorageServicePredicate(final String location) {
this.location = location;
}
@Override
- public boolean apply(StorageService input) {
- return input.storageServiceProperties().location().equals(location) && input.storageServiceProperties().status().equals("Created");
+ public boolean apply(final StorageService input) {
+ return input.storageServiceProperties().location().equals(location)
+ && input.storageServiceProperties().status().equals("Created");
}
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
index 9250369..8987dea 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
@@ -34,24 +34,28 @@ import com.google.inject.Singleton;
@Singleton
public class UseNodeCredentialsButOverrideFromTemplate extends PrioritizeCredentialsFromTemplate {
-
@Inject
public UseNodeCredentialsButOverrideFromTemplate(
Function<Template, LoginCredentials> credentialsFromImageOrTemplateOptions) {
+
super(credentialsFromImageOrTemplateOptions);
}
- public LoginCredentials apply(Template template, LoginCredentials fromNode) {
- RunScriptOptions options = checkNotNull(template.getOptions(), "template options are required");
- LoginCredentials.Builder builder = LoginCredentials.builder(fromNode);
- if (options.getLoginUser() != null)
+ public LoginCredentials apply(final Template template, final LoginCredentials fromNode) {
+ final RunScriptOptions options = checkNotNull(template.getOptions(), "template options are required");
+ final LoginCredentials.Builder builder = LoginCredentials.builder(fromNode);
+ if (options.getLoginUser() != null) {
builder.user(template.getOptions().getLoginUser());
- if (options.getLoginPassword() != null)
+ }
+ if (options.getLoginPassword() != null) {
builder.password(options.getLoginPassword());
- if (options.getLoginPrivateKey() != null)
+ }
+ if (options.getLoginPrivateKey() != null) {
builder.privateKey(options.getLoginPrivateKey());
- if (options.shouldAuthenticateSudo() != null && options.shouldAuthenticateSudo())
+ }
+ if (options.shouldAuthenticateSudo() != null && options.shouldAuthenticateSudo()) {
builder.authenticateSudo(true);
+ }
return builder.build();
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
index 9dbaf1e..4c5961c 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
@@ -17,7 +17,6 @@
package org.jclouds.azurecompute.config;
import java.security.KeyStore;
-
import javax.net.ssl.SSLContext;
import org.jclouds.azurecompute.AzureComputeApi;
@@ -51,9 +50,11 @@ public class AzureComputeHttpApiModule extends HttpApiModule<AzureComputeApi> {
@Override
protected void installLocations() {
install(new LocationModule());
- bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstRegionOptionallyMatchingRegionId.class).in(Scopes.SINGLETON);
+ bind(ImplicitLocationSupplier.class).
+ to(OnlyLocationOrFirstRegionOptionallyMatchingRegionId.class).
+ in(Scopes.SINGLETON);
}
-
+
@Override
protected void configure() {
install(new AzureComputeParserModule());
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeParserModule.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeParserModule.java b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeParserModule.java
index cc001d1..f357ad4 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeParserModule.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeParserModule.java
@@ -21,7 +21,9 @@ import org.jclouds.json.config.GsonModule;
import com.google.inject.AbstractModule;
public class AzureComputeParserModule extends AbstractModule {
- @Override protected void configure() {
+
+ @Override
+ protected void configure() {
bind(GsonModule.DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeProperties.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeProperties.java b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeProperties.java
index ccdc61a..9592f4c 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeProperties.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeProperties.java
@@ -17,12 +17,11 @@
package org.jclouds.azurecompute.config;
/**
- * Configuration properties and constants used in Azure Service Management
- * connections.
+ * Configuration properties and constants used in Azure Service Management connections.
*/
public class AzureComputeProperties {
- public static final String OPERATION_TIMEOUT = "jclouds.azurecompute.operation.timeout";
+ public static final String OPERATION_TIMEOUT = "jclouds.azurecompute.operation.timeout";
public static final String OPERATION_POLL_INITIAL_PERIOD = "jclouds.azurecompute..operation.poll.initial.period";
@@ -31,4 +30,5 @@ public class AzureComputeProperties {
public static final String TCP_RULE_FORMAT = "jclouds.azurecompute.tcp.rule.format";
public static final String TCP_RULE_REGEXP = "jclouds.azurecompute.tcp.rule.regexp";
+
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Availability.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Availability.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Availability.java
index 26ecbf7..c770b9e 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Availability.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Availability.java
@@ -23,13 +23,15 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class Availability {
- Availability() {} // For AutoValue only!
+ Availability() {
+ } // For AutoValue only!
public abstract Boolean result();
- @Nullable public abstract String reason();
+ @Nullable
+ public abstract String reason();
- public static Availability create(Boolean result, String reason) {
+ public static Availability create(final Boolean result, final String reason) {
return new AutoValue_Availability(result, reason);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CloudService.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CloudService.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CloudService.java
index 2187a75..118f8b6 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CloudService.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/CloudService.java
@@ -25,9 +25,8 @@ import org.jclouds.javax.annotation.Nullable;
import com.google.auto.value.AutoValue;
/**
- * System properties for the specified cloud service. These properties include the service name and
- * service type; the name of the affinity group to which the service belongs, or its location if it
- * is not part of an affinity group.
+ * System properties for the specified cloud service. These properties include the service name and service type; the
+ * name of the affinity group to which the service belongs, or its location if it is not part of an affinity group.
*
* @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >CloudService</a>
*/
@@ -35,33 +34,42 @@ import com.google.auto.value.AutoValue;
public abstract class CloudService {
public enum Status {
- CREATING, CREATED, DELETING, DELETED, CHANGING, RESOLVING_DNS,
+
+ CREATING,
+ CREATED,
+ DELETING,
+ DELETED,
+ CHANGING,
+ RESOLVING_DNS,
UNRECOGNIZED;
+
}
- CloudService() {} // For AutoValue only!
+ CloudService() {
+ } // For AutoValue only!
/**
- * The name of the cloud service. This name is the DNS prefix name and can be used to access the
- * cloud service.
+ * The name of the cloud service. This name is the DNS prefix name and can be used to access the cloud service.
*
- * <p/>For example, if the service name is MyService you could access the access the service by
- * calling: http://MyService.cloudapp.net
+ * <p/>
+ * For example, if the service name is MyService you could access the access the service by calling:
+ * http://MyService.cloudapp.net
*/
public abstract String name();
/**
- * The geo-location of the cloud service in Windows Azure, if the cloud service is not
- * associated with an affinity group. If a location has been specified, the AffinityGroup element
- * is not returned.
+ * The geo-location of the cloud service in Windows Azure, if the cloud service is not associated with an affinity
+ * group. If a location has been specified, the AffinityGroup element is not returned.
*/
- @Nullable public abstract String location();
+ @Nullable
+ public abstract String location();
/**
- * The affinity group with which this cloud service is associated, if any. If the service is
- * associated with an affinity group, the Location element is not returned.
+ * The affinity group with which this cloud service is associated, if any. If the service is associated with an
+ * affinity group, the Location element is not returned.
*/
- @Nullable public abstract String affinityGroup();
+ @Nullable
+ public abstract String affinityGroup();
/**
* The name can be up to 100 characters in length. The name can be used identify the storage account for your
@@ -69,7 +77,8 @@ public abstract class CloudService {
*/
public abstract String label();
- @Nullable public abstract String description();
+ @Nullable
+ public abstract String description();
public abstract Status status();
@@ -78,19 +87,21 @@ public abstract class CloudService {
public abstract Date lastModified();
/**
- * Represents the name of an extended cloud service property. Each extended property must have
- * both a defined name and value. You can have a maximum of 50 extended property name/value
- * pairs.
+ * Represents the name of an extended cloud service property. Each extended property must have both a defined name
+ * and value. You can have a maximum of 50 extended property name/value pairs.
*
- * <p/>The maximum length of the Name element is 64 characters, only alphanumeric characters and
- * underscores are valid in the Name, and the name must start with a letter. Each extended
- * property value has a maximum length of 255 characters.
+ * <p/>
+ * The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in
+ * the Name, and the name must start with a letter. Each extended property value has a maximum length of 255
+ * characters.
*/
public abstract Map<String, String> extendedProperties();
- public static CloudService create(String name, String location, String affinityGroup, String label,
- String description, Status status, Date created, Date lastModified, Map<String, String> extendedProperties) {
+ public static CloudService create(final String name, final String location, final String affinityGroup,
+ final String label, final String description, final Status status, final Date created,
+ final Date lastModified, final Map<String, String> extendedProperties) {
+
return new AutoValue_CloudService(name, location, affinityGroup, label, description, status, created,
- lastModified, copyOf(extendedProperties));
+ lastModified, copyOf(extendedProperties));
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DataVirtualHardDisk.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DataVirtualHardDisk.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DataVirtualHardDisk.java
index 2dcaa70..7690d3b 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DataVirtualHardDisk.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DataVirtualHardDisk.java
@@ -24,41 +24,40 @@ import java.net.URI;
/**
* @see <a href="https://msdn.microsoft.com/en-us/library/azure/jj157193.aspx#DataVirtualHardDisks" >api</a>
*/
-
@AutoValue
public abstract class DataVirtualHardDisk {
public enum Caching {
+
READ_ONLY,
READ_WRITE,
NONE
+
}
/**
- * Specifies the caching mode of the operating system disk.
- * This setting impacts the consistency and performance of the disk.
- * Possible values are:
- * ReadOnly
- * ReadWrite
- * The default value is ReadWrite
+ * Specifies the caching mode of the operating system disk. This setting impacts the consistency and performance of
+ * the disk. Possible values are: ReadOnly ReadWrite The default value is ReadWrite
*/
- @Nullable public abstract Caching hostCaching();
+ @Nullable
+ public abstract Caching hostCaching();
/**
- * Required if an existing disk is being used to create a Virtual Machine.
- * Specifies the name of a new or existing disk
+ * Required if an existing disk is being used to create a Virtual Machine. Specifies the name of a new or existing
+ * disk
*/
- @Nullable public abstract String diskName();
+ @Nullable
+ public abstract String diskName();
/**
- * Specifies the Logical Unit Number (LUN) for the data disk. If the disk is the first disk that is added,
- * this element is optional and the default value of 0 is used. If more than one disk is being added,
- * this element is required.
+ * Specifies the Logical Unit Number (LUN) for the data disk. If the disk is the first disk that is added, this
+ * element is optional and the default value of 0 is used. If more than one disk is being added, this element is
+ * required.
* <p/>
- * You can use Get Role to find the LUN numbers that are already being used.
- * Valid LUN values are 0 through 31
+ * You can use Get Role to find the LUN numbers that are already being used. Valid LUN values are 0 through 31
*/
- @Nullable public abstract Integer lun();
+ @Nullable
+ public abstract Integer lun();
/**
* Specifies the size, in GB, of an empty disk to be attached to the Virtual Machine.If the disk that is being added
@@ -69,27 +68,30 @@ public abstract class DataVirtualHardDisk {
* <p/>
* This element is used with the MediaLink element.
*/
- @Nullable public abstract Integer logicalDiskSizeInGB();
+ @Nullable
+ public abstract Integer logicalDiskSizeInGB();
/**
* If the disk that is being added is already registered in the subscription or the VHD for the disk already exists
* in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the
- * location of the new VHD that is created when the new disk is added.
- * Example:
+ * location of the new VHD that is created when the new disk is added. Example:
* http://example.blob.core.windows.net/disks/mydatadisk.vhd
*/
- @Nullable public abstract URI mediaLink();
+ @Nullable
+ public abstract URI mediaLink();
/**
- * This property identifies the type of the storage account for the backing VHD.
- * If the backing VHD is in an Provisioned Storage account, “Provisioned” is returned otherwise “Standard”
- * is returned.
+ * This property identifies the type of the storage account for the backing VHD. If the backing VHD is in an
+ * Provisioned Storage account, “Provisioned” is returned otherwise “Standard” is returned.
* <p/>
* This property is only returned with a version header of 2014-10-01 or newer
*/
- @Nullable public abstract String ioType();
+ @Nullable
+ public abstract String ioType();
+
+ public static DataVirtualHardDisk create(final Caching hostCaching, final String diskName,
+ final Integer lun, final Integer logicalDiskSizeInGB, final URI mediaLink, final String ioType) {
- public static DataVirtualHardDisk create(Caching hostCaching, String diskName, Integer lun, Integer logicalDiskSizeInGB, URI mediaLink, String ioType) {
return new AutoValue_DataVirtualHardDisk(hostCaching, diskName, lun, logicalDiskSizeInGB, mediaLink, ioType);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Deployment.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Deployment.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Deployment.java
index 9dc25a6..985379a 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Deployment.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Deployment.java
@@ -17,6 +17,7 @@
package org.jclouds.azurecompute.domain;
import static com.google.common.collect.ImmutableList.copyOf;
+
import java.util.List;
import org.jclouds.javax.annotation.Nullable;
@@ -27,22 +28,53 @@ import com.google.auto.value.AutoValue;
public abstract class Deployment {
public enum Slot {
- PRODUCTION, STAGING,
+
+ PRODUCTION,
+ STAGING,
UNRECOGNIZED;
+
}
public enum Status {
- RUNNING, SUSPENDED, RUNNING_TRANSITIONING, SUSPENDED_TRANSITIONING, STARTING, SUSPENDING, DEPLOYING, DELETING,
+
+ RUNNING,
+ SUSPENDED,
+ RUNNING_TRANSITIONING,
+ SUSPENDED_TRANSITIONING,
+ STARTING,
+ SUSPENDING,
+ DEPLOYING,
+ DELETING,
UNRECOGNIZED;
+
}
public enum InstanceStatus {
- CREATING_VM, STARTING_VM, CREATING_ROLE, STARTING_ROLE, READY_ROLE, BUSY_ROLE, STOPPING_ROLE, STOPPING_VM,
- DELETING_VM, STOPPED_VM, RESTARTING_ROLE, CYCLING_ROLE, FAILED_STARTING_ROLE, FAILED_STARTING_VM, UNRESPONSIVE_ROLE,
- STOPPED_DEALLOCATED, PREPARING,
- /** Unknown to Azure. */
+
+ CREATING_VM,
+ STARTING_VM,
+ CREATING_ROLE,
+ STARTING_ROLE,
+ READY_ROLE,
+ BUSY_ROLE,
+ STOPPING_ROLE,
+ STOPPING_VM,
+ DELETING_VM,
+ STOPPED_VM,
+ RESTARTING_ROLE,
+ CYCLING_ROLE,
+ FAILED_STARTING_ROLE,
+ FAILED_STARTING_VM,
+ UNRESPONSIVE_ROLE,
+ STOPPED_DEALLOCATED,
+ PREPARING,
+ /**
+ * Unknown to Azure.
+ */
UNKNOWN,
- /** Not parsable into one of the above. */
+ /**
+ * Not parsable into one of the above.
+ */
UNRECOGNIZED,
}
@@ -58,7 +90,7 @@ public abstract class Deployment {
VirtualIP() { // For AutoValue only!
}
- public static VirtualIP create(String address, Boolean isDnsProgrammed, String name) {
+ public static VirtualIP create(final String address, final Boolean isDnsProgrammed, final String name) {
return new AutoValue_Deployment_VirtualIP(address, isDnsProgrammed, name);
}
}
@@ -79,7 +111,9 @@ public abstract class Deployment {
InstanceEndpoint() { // For AutoValue only!
}
- public static InstanceEndpoint create(String name, String vip, int publicPort, int localPort, String protocol) {
+ public static InstanceEndpoint create(final String name, final String vip,
+ final int publicPort, final int localPort, final String protocol) {
+
return new AutoValue_Deployment_InstanceEndpoint(name, vip, publicPort, localPort, protocol);
}
}
@@ -105,80 +139,92 @@ public abstract class Deployment {
@Nullable // null value in case of StoppedDeallocated
public abstract String ipAddress();
- @Nullable public abstract String hostname();
+ @Nullable
+ public abstract String hostname();
- @Nullable public abstract List<InstanceEndpoint> instanceEndpoints();
+ @Nullable
+ public abstract List<InstanceEndpoint> instanceEndpoints();
RoleInstance() { // For AutoValue only!
}
- public static RoleInstance create(String roleName, String instanceName, InstanceStatus instanceStatus, int instanceUpgradeDomain,
- int instanceFaultDomain, RoleSize.Type instanceSize, String ipAddress, String hostname, List<InstanceEndpoint> instanceEndpoints) {
+ public static RoleInstance create(final String roleName, final String instanceName,
+ final InstanceStatus instanceStatus, final int instanceUpgradeDomain,
+ final int instanceFaultDomain, final RoleSize.Type instanceSize,
+ final String ipAddress, final String hostname, final List<InstanceEndpoint> instanceEndpoints) {
+
return new AutoValue_Deployment_RoleInstance(roleName, instanceName, instanceStatus, instanceUpgradeDomain,
- instanceFaultDomain, instanceSize, ipAddress, hostname, instanceEndpoints == null ? null : copyOf(instanceEndpoints));
+ instanceFaultDomain, instanceSize, ipAddress, hostname,
+ instanceEndpoints == null ? null : copyOf(instanceEndpoints));
}
}
- Deployment() {} // For AutoValue only!
-
+ Deployment() {
+ } // For AutoValue only!
- /** The user-supplied name for this deployment. */
+ /**
+ * The user-supplied name for this deployment.
+ */
public abstract String name();
- /** The environment to which the cloud service is deployed. */
+ /**
+ * The environment to which the cloud service is deployed.
+ */
public abstract Slot slot();
public abstract Status status();
/**
- * The user-supplied name of the deployment returned as a base-64 encoded
- * string. This name can be used identify the deployment for your tracking
- * purposes.
+ * The user-supplied name of the deployment returned as a base-64 encoded string. This name can be used identify the
+ * deployment for your tracking purposes.
*/
public abstract String label();
/**
- * The instance state is returned as an English human-readable string that,
- * when present, provides a snapshot of the state of the virtual machine at
- * the time the operation was called.
+ * The instance state is returned as an English human-readable string that, when present, provides a snapshot of the
+ * state of the virtual machine at the time the operation was called.
*
- * For example, when the instance is first being initialized a
- * "Preparing Windows for first use." could be returned.
+ * For example, when the instance is first being initialized a "Preparing Windows for first use." could be returned.
*/
- @Nullable public abstract String instanceStateDetails();
+ @Nullable
+ public abstract String instanceStateDetails();
/**
* Error code of the latest role or VM start
*
* For VMRoles the error codes are:
*
- * WaitTimeout - The virtual machine did not communicate back to Azure
- * infrastructure within 25 minutes. Typically this indicates that the
- * virtual machine did not start or that the guest agent is not installed.
+ * WaitTimeout - The virtual machine did not communicate back to Azure infrastructure within 25 minutes. Typically
+ * this indicates that the virtual machine did not start or that the guest agent is not installed.
*
- * VhdTooLarge - The VHD image selected was too large for the virtual
- * machine hosting the role.
+ * VhdTooLarge - The VHD image selected was too large for the virtual machine hosting the role.
*
- * AzureInternalError – An internal error has occurred that has caused to
- * virtual machine to fail to start. Contact support for additional
- * assistance.
+ * AzureInternalError – An internal error has occurred that has caused to virtual machine to fail to start. Contact
+ * support for additional assistance.
*
* For web and worker roles this field returns an error code that can be provided to Windows Azure support to assist
* in resolution of errors. Typically this field will be empty.
*/
- @Nullable public abstract String instanceErrorCode();
+ @Nullable
+ public abstract String instanceErrorCode();
public abstract List<VirtualIP> virtualIPs();
public abstract List<RoleInstance> roleInstanceList();
- @Nullable public abstract List<Role> roles();
+ @Nullable
+ public abstract List<Role> roles();
+
+ @Nullable
+ public abstract String virtualNetworkName();
- @Nullable public abstract String virtualNetworkName();
+ public static Deployment create(final String name, final Slot slot, final Status status, final String label,
+ final String instanceStateDetails, final String instanceErrorCode,
+ final List<VirtualIP> virtualIPs, final List<RoleInstance> roleInstanceList,
+ final List<Role> roles, final String virtualNetworkName) {
- public static Deployment create(String name, Slot slot, Status status, String label, String instanceStateDetails, String instanceErrorCode,
- List<VirtualIP> virtualIPs, List<RoleInstance> roleInstanceList, List<Role> roles, String virtualNetworkName) {
return new AutoValue_Deployment(name, slot, status, label, instanceStateDetails,
- instanceErrorCode, copyOf(virtualIPs), copyOf(roleInstanceList), roles == null ? null : copyOf(roles), virtualNetworkName);
+ instanceErrorCode, copyOf(virtualIPs), copyOf(roleInstanceList),
+ roles == null ? null : copyOf(roles), virtualNetworkName);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
index 5260b0f..0ca7a83 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
@@ -17,6 +17,7 @@
package org.jclouds.azurecompute.domain;
import static com.google.common.collect.ImmutableList.copyOf;
+
import java.net.URI;
import java.util.Collection;
import java.util.List;
@@ -35,67 +36,82 @@ import com.google.common.collect.Lists;
// TODO: check which can be null.
@AutoValue
public abstract class DeploymentParams {
+
@AutoValue
public abstract static class ExternalEndpoint {
public abstract String name();
- /** Either {@code tcp} or {@code udp}. */
+ /**
+ * Either {@code tcp} or {@code udp}.
+ */
public abstract String protocol();
public abstract int port();
public abstract int localPort();
- public static ExternalEndpoint inboundTcpToLocalPort(int port, int localPort) {
- return new AutoValue_DeploymentParams_ExternalEndpoint(String.format("tcp_%s-%s", port, localPort), "tcp",
- port, localPort);
+ public static ExternalEndpoint inboundTcpToLocalPort(final int port, final int localPort) {
+ return new AutoValue_DeploymentParams_ExternalEndpoint(
+ String.format("tcp_%s-%s", port, localPort), "tcp", port, localPort);
}
- public static ExternalEndpoint inboundUdpToLocalPort(int port, int localPort) {
- return new AutoValue_DeploymentParams_ExternalEndpoint(String.format("udp_%s-%s", port, localPort), "udp",
- port, localPort);
+ public static ExternalEndpoint inboundUdpToLocalPort(final int port, final int localPort) {
+ return new AutoValue_DeploymentParams_ExternalEndpoint(
+ String.format("udp_%s-%s", port, localPort), "udp", port, localPort);
}
ExternalEndpoint() { // For AutoValue only!
}
}
- DeploymentParams() {} // For AutoValue only!
+ DeploymentParams() {
+ } // For AutoValue only!
- /** The user-supplied name for this deployment. */
+ /**
+ * The user-supplied name for this deployment.
+ */
public abstract String name();
- /** The size of the virtual machine to allocate. The default value is Small. */
+ /**
+ * The size of the virtual machine to allocate. The default value is Small.
+ */
public abstract RoleSize.Type size();
/**
- * Specifies the name of a user to be created in the sudoers group of the
- * virtual machine. User names are ASCII character strings 1 to 32
- * characters in length.
+ * Specifies the name of a user to be created in the sudoers group of the virtual machine. User names are ASCII
+ * character strings 1 to 32 characters in length.
*/
public abstract String username();
/**
- * Specifies the associated password for the user name.
- * Passwords are ASCII character strings 6 to 72 characters in
+ * Specifies the associated password for the user name. Passwords are ASCII character strings 6 to 72 characters in
* length.
*/
public abstract String password();
- /** {@link OSImage#name() name} of the user or platform image. */
+ /**
+ * {@link OSImage#name() name} of the user or platform image.
+ */
public abstract String sourceImageName();
- /** Indicates the {@link OSImage#mediaLink() location} when {@link #sourceImageName() source} is a platform image. */
+ /**
+ * Indicates the {@link OSImage#mediaLink() location} when {@link #sourceImageName() source} is a platform image.
+ */
public abstract URI mediaLink();
- /** {@link OSImage#os() Os type} of the {@link #sourceImageName() source image}. */
+ /**
+ * {@link OSImage#os() Os type} of the {@link #sourceImageName() source image}.
+ */
public abstract OSImage.Type os();
public abstract List<ExternalEndpoint> externalEndpoints();
- /** {@link org.jclouds.azurecompute.domain.NetworkConfiguration.VirtualNetworkSite#name} */
- @Nullable public abstract String virtualNetworkName();
+ /**
+ * {@link org.jclouds.azurecompute.domain.NetworkConfiguration.VirtualNetworkSite#name}
+ */
+ @Nullable
+ public abstract String virtualNetworkName();
public abstract List<String> subnetNames();
@@ -108,98 +124,110 @@ public abstract class DeploymentParams {
}
public static final class Builder {
+
private String name;
+
private RoleSize.Type size;
+
private String username;
+
private String password;
+
private String sourceImageName;
+
private URI mediaLink;
+
private OSImage.Type os;
+
private List<ExternalEndpoint> externalEndpoints = Lists.newArrayList();
+
private String virtualNetworkName;
+
private List<String> subnetNames = Lists.newArrayList();
- public Builder name(String name) {
+ public Builder name(final String name) {
this.name = name;
return this;
}
- public Builder size(RoleSize.Type size) {
+ public Builder size(final RoleSize.Type size) {
this.size = size;
return this;
}
- public Builder username(String username) {
+ public Builder username(final String username) {
this.username = username;
return this;
}
- public Builder password(String password) {
+ public Builder password(final String password) {
this.password = password;
return this;
}
- public Builder sourceImageName(String sourceImageName) {
+ public Builder sourceImageName(final String sourceImageName) {
this.sourceImageName = sourceImageName;
return this;
}
- public Builder mediaLink(URI mediaLink) {
+ public Builder mediaLink(final URI mediaLink) {
this.mediaLink = mediaLink;
return this;
}
- public Builder os(OSImage.Type os) {
+ public Builder os(final OSImage.Type os) {
this.os = os;
return this;
}
- public Builder externalEndpoint(ExternalEndpoint endpoint) {
+ public Builder externalEndpoint(final ExternalEndpoint endpoint) {
externalEndpoints.add(endpoint);
return this;
}
- public Builder externalEndpoints(Collection<ExternalEndpoint> externalEndpoints) {
+ public Builder externalEndpoints(final Collection<ExternalEndpoint> externalEndpoints) {
this.externalEndpoints.addAll(externalEndpoints);
return this;
}
- public Builder virtualNetworkName(String virtualNetworkName) {
+ public Builder virtualNetworkName(final String virtualNetworkName) {
this.virtualNetworkName = virtualNetworkName;
return this;
}
- public Builder subnetName(String subnetName) {
+ public Builder subnetName(final String subnetName) {
subnetNames.add(subnetName);
return this;
}
- public Builder subnetNames(Collection<String> subnetNames) {
+ public Builder subnetNames(final Collection<String> subnetNames) {
this.subnetNames.addAll(subnetNames);
return this;
}
public DeploymentParams build() {
return DeploymentParams.create(name, size, username, password, sourceImageName, mediaLink, os,
- ImmutableList.copyOf(externalEndpoints), virtualNetworkName, ImmutableList.copyOf(subnetNames));
+ ImmutableList.copyOf(externalEndpoints), virtualNetworkName, ImmutableList.copyOf(subnetNames));
}
- public Builder fromDeploymentParams(DeploymentParams in) {
- return name(in.name())
- .size(in.size())
- .username(in.username())
- .password(in.password())
- .sourceImageName(in.sourceImageName())
- .mediaLink(in.mediaLink())
- .os(in.os())
- .externalEndpoints(in.externalEndpoints())
- .subnetNames(in.subnetNames());
+ public Builder fromDeploymentParams(final DeploymentParams deploymentParams) {
+ return name(deploymentParams.name())
+ .size(deploymentParams.size())
+ .username(deploymentParams.username())
+ .password(deploymentParams.password())
+ .sourceImageName(deploymentParams.sourceImageName())
+ .mediaLink(deploymentParams.mediaLink())
+ .os(deploymentParams.os())
+ .externalEndpoints(deploymentParams.externalEndpoints())
+ .subnetNames(deploymentParams.subnetNames());
}
}
- private static DeploymentParams create(String name, RoleSize.Type size, String username, String password, String sourceImageName,
- URI mediaLink, OSImage.Type os, List<ExternalEndpoint> externalEndpoints,
- String virtualNetworkName, List<String> subnetNames) {
+ private static DeploymentParams create(final String name, final RoleSize.Type size,
+ final String username, final String password, final String sourceImageName,
+ final URI mediaLink, final OSImage.Type os, final List<ExternalEndpoint> externalEndpoints,
+ final String virtualNetworkName, final List<String> subnetNames) {
+
return new AutoValue_DeploymentParams(name, size, username, password, sourceImageName, mediaLink, os,
copyOf(externalEndpoints), virtualNetworkName, copyOf(subnetNames));
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
index 2f211aa..4648145 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
@@ -30,80 +30,99 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class Disk {
- Disk() {} // For AutoValue only!
+ Disk() {
+ } // For AutoValue only!
@AutoValue
public abstract static class Attachment {
- Attachment() {} // For AutoValue only!
+ Attachment() {
+ } // For AutoValue only!
- /** The deployment in which the disk is being used. */
+ /**
+ * The deployment in which the disk is being used.
+ */
public abstract String deployment();
- /** The cloud service in which the disk is being used. */
+ /**
+ * The cloud service in which the disk is being used.
+ */
public abstract String hostedService();
- /** The virtual machine that the disk is attached to. */
+ /**
+ * The virtual machine that the disk is attached to.
+ */
public abstract String virtualMachine();
- public static Attachment create(String hostedService, String deployment, String virtualMachine) {
+ public static Attachment create(
+ final String hostedService, final String deployment, final String virtualMachine) {
+
return new AutoValue_Disk_Attachment(hostedService, deployment, virtualMachine);
}
}
/**
- * The name of the disk. This is the name that is used when creating one or more virtual machines
- * using the disk.
+ * The name of the disk. This is the name that is used when creating one or more virtual machines using the disk.
*/
public abstract String name();
/**
- * The geo-location of the disk in Windows Azure, if the disk is not
- * associated with an affinity group. If a location has been specified, the AffinityGroup element
- * is not returned.
+ * The geo-location of the disk in Windows Azure, if the disk is not associated with an affinity group. If a location
+ * has been specified, the AffinityGroup element is not returned.
*/
- @Nullable public abstract String location();
+ @Nullable
+ public abstract String location();
/**
- * The affinity group with which this disk is associated, if any. If the service is
- * associated with an affinity group, the Location element is not returned.
+ * The affinity group with which this disk is associated, if any. If the service is associated with an affinity
+ * group, the Location element is not returned.
*/
- @Nullable public abstract String affinityGroup();
+ @Nullable
+ public abstract String affinityGroup();
- @Nullable public abstract String description();
+ @Nullable
+ public abstract String description();
- /** The operating system type of the OS image, or null if a data disk. */
- @Nullable public abstract OSImage.Type os();
+ /**
+ * The operating system type of the OS image, or null if a data disk.
+ */
+ @Nullable
+ public abstract OSImage.Type os();
/**
- * The location of the blob in the blob store in which the media for the image is located. The
- * blob location belongs to a storage account in the subscription specified by the
+ * The location of the blob in the blob store in which the media for the image is located. The blob location belongs
+ * to a storage account in the subscription specified by the
* <subscription-id> value in the operation call.
*
* Example:
*
* http://example.blob.core.windows.net/disks/myimage.vhd
*/
- @Nullable public abstract URI mediaLink();
+ @Nullable
+ public abstract URI mediaLink();
- @Nullable public abstract Integer logicalSizeInGB();
+ @Nullable
+ public abstract Integer logicalSizeInGB();
/**
- * Contains properties that specify a virtual machine that currently using the disk. A disk
- * cannot be deleted as long as it is attached to a virtual machine.
+ * Contains properties that specify a virtual machine that currently using the disk. A disk cannot be deleted as long
+ * as it is attached to a virtual machine.
*/
- @Nullable public abstract Attachment attachedTo();
+ @Nullable
+ public abstract Attachment attachedTo();
/**
- * The name of the OS Image from which the disk was created. This property is populated
- * automatically when a disk is created from an OS image by calling the Add Role, Create
- * Deployment, or Provision Disk operations.
+ * The name of the OS Image from which the disk was created. This property is populated automatically when a disk is
+ * created from an OS image by calling the Add Role, Create Deployment, or Provision Disk operations.
*/
- @Nullable public abstract String sourceImage();
+ @Nullable
+ public abstract String sourceImage();
+
+ public static Disk create(final String name, final String location, final String affinityGroup,
+ final String description, final OSImage.Type os,
+ final URI mediaLink, final Integer logicalSizeInGB, final Attachment attachedTo, final String sourceImage) {
- public static Disk create(String name, String location, String affinityGroup, String description, OSImage.Type os,
- URI mediaLink, Integer logicalSizeInGB, Attachment attachedTo, String sourceImage) {
- return new AutoValue_Disk(name, location, affinityGroup, description, os, mediaLink, logicalSizeInGB, attachedTo,
- sourceImage);
+ return new AutoValue_Disk(
+ name, location, affinityGroup, description, os, mediaLink, logicalSizeInGB, attachedTo, sourceImage);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Error.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Error.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Error.java
index 40d6e02..03af71c 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Error.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Error.java
@@ -25,6 +25,7 @@ import com.google.auto.value.AutoValue;
public abstract class Error {
public static enum Code {
+
MISSING_OR_INCORRECT_VERSION_HEADER,
INVALID_XML_REQUEST,
MISSING_OR_INVALID_REQUIRED_QUERY_PARAMETER,
@@ -38,17 +39,23 @@ public abstract class Error {
BAD_REQUEST,
CONFLICT_ERROR,
UNRECOGNIZED;
+
}
- Error() {} // For AutoValue only!
+ Error() {
+ } // For AutoValue only!
- /** Error code */
+ /**
+ * Error code
+ */
public abstract Code code();
- /** User message */
+ /**
+ * User message
+ */
public abstract String message();
- public static Error create(Code code, String message) {
+ public static Error create(final Code code, final String message) {
return new AutoValue_Error(code, message);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Location.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Location.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Location.java
index 1cf1005..65932f8 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Location.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Location.java
@@ -21,22 +21,31 @@ import java.util.List;
import com.google.auto.value.AutoValue;
-/** A data center location that is valid for your subscription. */
+/**
+ * A data center location that is valid for your subscription.
+ */
@AutoValue
public abstract class Location {
- Location() {} // For AutoValue only!
+ Location() {
+ } // For AutoValue only!
- /** The name of the data center location. Ex. {@code West Europe}. */
+ /**
+ * The name of the data center location. Ex. {@code West Europe}.
+ */
public abstract String name();
- /** The localized name of the data center location. */
+ /**
+ * The localized name of the data center location.
+ */
public abstract String displayName();
- /** Indicates the services available at this location. Ex. {@code Compute}. */
+ /**
+ * Indicates the services available at this location. Ex. {@code Compute}.
+ */
public abstract List<String> availableServices();
- public static Location create(String name, String displayName, List<String> availableServices) {
+ public static Location create(final String name, final String displayName, final List<String> availableServices) {
return new AutoValue_Location(name, displayName, copyOf(availableServices));
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkConfiguration.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkConfiguration.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkConfiguration.java
index 22df816..86c7027 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkConfiguration.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkConfiguration.java
@@ -29,15 +29,18 @@ public abstract class NetworkConfiguration {
@AutoValue
public abstract static class Subnet {
- Subnet() {} // For AutoValue only!
+ Subnet() {
+ } // For AutoValue only!
public abstract String name();
- @Nullable public abstract String addressPrefix();
+ @Nullable
+ public abstract String addressPrefix();
- @Nullable public abstract String networkSecurityGroup();
+ @Nullable
+ public abstract String networkSecurityGroup();
- public static Subnet create(String name, String addressPrefix, String networkSecurityGroup) {
+ public static Subnet create(final String name, final String addressPrefix, final String networkSecurityGroup) {
return new AutoValue_NetworkConfiguration_Subnet(name, addressPrefix, networkSecurityGroup);
}
}
@@ -45,11 +48,13 @@ public abstract class NetworkConfiguration {
@AutoValue
public abstract static class AddressSpace {
- AddressSpace() {} // For AutoValue only!
+ AddressSpace() {
+ } // For AutoValue only!
- @Nullable public abstract String addressPrefix();
+ @Nullable
+ public abstract String addressPrefix();
- public static AddressSpace create(String addressPrefix) {
+ public static AddressSpace create(final String addressPrefix) {
return new AutoValue_NetworkConfiguration_AddressSpace(addressPrefix);
}
}
@@ -57,19 +62,26 @@ public abstract class NetworkConfiguration {
@AutoValue
public abstract static class VirtualNetworkSite {
- VirtualNetworkSite() {} // For AutoValue only!
+ VirtualNetworkSite() {
+ } // For AutoValue only!
- @Nullable public abstract String id();
+ @Nullable
+ public abstract String id();
- @Nullable public abstract String name();
+ @Nullable
+ public abstract String name();
- @Nullable public abstract String location();
+ @Nullable
+ public abstract String location();
public abstract AddressSpace addressSpace();
public abstract List<Subnet> subnets();
- public static VirtualNetworkSite create(String id, String name, String location, AddressSpace addressSpace, List<Subnet> subnets) {
+ public static VirtualNetworkSite create(
+ final String id, final String name, final String location,
+ final AddressSpace addressSpace, final List<Subnet> subnets) {
+
return new AutoValue_NetworkConfiguration_VirtualNetworkSite(id, name, location, addressSpace, subnets);
}
@@ -81,19 +93,25 @@ public abstract class NetworkConfiguration {
VirtualNetworkConfiguration() {
} // For AutoValue only!
- @Nullable public abstract String dns();
- @Nullable public abstract List<VirtualNetworkSite> virtualNetworkSites();
+ @Nullable
+ public abstract String dns();
+
+ @Nullable
+ public abstract List<VirtualNetworkSite> virtualNetworkSites();
+
+ public static VirtualNetworkConfiguration create(
+ final String dns, final List<VirtualNetworkSite> virtualNetworkSites) {
- public static VirtualNetworkConfiguration create(String dns, List<VirtualNetworkSite> virtualNetworkSites) {
return new AutoValue_NetworkConfiguration_VirtualNetworkConfiguration(dns, copyOf(virtualNetworkSites));
}
}
- public NetworkConfiguration() {} // For AutoValue only!
+ public NetworkConfiguration() {
+ } // For AutoValue only!
public abstract VirtualNetworkConfiguration virtualNetworkConfiguration();
- public static NetworkConfiguration create(VirtualNetworkConfiguration virtualNetworkConfiguration) {
+ public static NetworkConfiguration create(final VirtualNetworkConfiguration virtualNetworkConfiguration) {
return new AutoValue_NetworkConfiguration(virtualNetworkConfiguration);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/2af28926/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkSecurityGroup.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkSecurityGroup.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkSecurityGroup.java
index 756634e..41e0193 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkSecurityGroup.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/NetworkSecurityGroup.java
@@ -26,18 +26,23 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class NetworkSecurityGroup {
- NetworkSecurityGroup() {} // For AutoValue only!
+ NetworkSecurityGroup() {
+ } // For AutoValue only!
public abstract String name();
- @Nullable public abstract String label();
+ @Nullable
+ public abstract String label();
- @Nullable public abstract String location();
+ @Nullable
+ public abstract String location();
- @Nullable public abstract List<Rule> rules();
+ @Nullable
+ public abstract List<Rule> rules();
+
+ public static NetworkSecurityGroup create(
+ final String name, final String label, String location, final List<Rule> rules) {
- public static NetworkSecurityGroup create(String name, String label, String location, List<Rule> rules) {
return new AutoValue_NetworkSecurityGroup(name, label, location, rules == null ? null : copyOf(rules));
}
}
-