JCLOUDS-1342 : Azure-ARM Virtual Machine Scale Set Support

This commit is contained in:
jucolon 2017-08-10 16:17:39 -04:00 committed by Ignasi Barrera
parent 8b33c44078
commit 7368d58ad9
37 changed files with 2635 additions and 36 deletions

View File

@ -20,27 +20,28 @@ import java.io.Closeable;
import javax.ws.rs.PathParam;
import org.jclouds.azurecompute.arm.features.AvailabilitySetApi;
import org.jclouds.azurecompute.arm.features.DeploymentApi;
import org.jclouds.azurecompute.arm.features.DiskApi;
import org.jclouds.azurecompute.arm.features.ImageApi;
import org.jclouds.azurecompute.arm.features.JobApi;
import org.jclouds.azurecompute.arm.features.LoadBalancerApi;
import org.jclouds.azurecompute.arm.features.LocationApi;
import org.jclouds.azurecompute.arm.features.MetricDefinitionsApi;
import org.jclouds.azurecompute.arm.features.MetricsApi;
import org.jclouds.azurecompute.arm.features.NetworkInterfaceCardApi;
import org.jclouds.azurecompute.arm.features.NetworkSecurityGroupApi;
import org.jclouds.azurecompute.arm.features.NetworkSecurityRuleApi;
import org.jclouds.azurecompute.arm.features.OSImageApi;
import org.jclouds.azurecompute.arm.features.PublicIPAddressApi;
import org.jclouds.azurecompute.arm.features.ResourceGroupApi;
import org.jclouds.azurecompute.arm.features.ResourceProviderApi;
import org.jclouds.azurecompute.arm.features.StorageAccountApi;
import org.jclouds.azurecompute.arm.features.SubnetApi;
import org.jclouds.azurecompute.arm.features.VMSizeApi;
import org.jclouds.azurecompute.arm.features.VirtualMachineApi;
import org.jclouds.azurecompute.arm.features.VirtualNetworkApi;
import org.jclouds.azurecompute.arm.features.NetworkInterfaceCardApi;
import org.jclouds.azurecompute.arm.features.PublicIPAddressApi;
import org.jclouds.azurecompute.arm.features.VirtualMachineApi;
import org.jclouds.azurecompute.arm.features.VirtualMachineScaleSetApi;
import org.jclouds.azurecompute.arm.features.VMSizeApi;
import org.jclouds.azurecompute.arm.features.OSImageApi;
import org.jclouds.azurecompute.arm.features.DeploymentApi;
import org.jclouds.azurecompute.arm.features.NetworkSecurityGroupApi;
import org.jclouds.azurecompute.arm.features.NetworkSecurityRuleApi;
import org.jclouds.azurecompute.arm.features.LoadBalancerApi;
import org.jclouds.azurecompute.arm.features.AvailabilitySetApi;
import org.jclouds.azurecompute.arm.features.ResourceProviderApi;
import org.jclouds.azurecompute.arm.features.DiskApi;
import org.jclouds.azurecompute.arm.features.ImageApi;
import org.jclouds.azurecompute.arm.features.MetricsApi;
import org.jclouds.azurecompute.arm.features.MetricDefinitionsApi;
import org.jclouds.rest.annotations.Delegate;
/**
@ -124,6 +125,14 @@ public interface AzureComputeApi extends Closeable {
@Delegate
VirtualMachineApi getVirtualMachineApi(@PathParam("resourceGroup") String resourceGroup);
/**
* The Virtual Machine Scale Set API includes operations for managing the virtual machines in your subscription.
*
* @see <a href="https://msdn.microsoft.com/en-us/library/azure/mt163630.aspx">docs</a>
*/
@Delegate
VirtualMachineScaleSetApi getVirtualMachineScaleSetApi(@PathParam("resourceGroup") String resourceGroup);
/**
* This Azure Resource Manager API lists all available virtual machine sizes for a subscription in a given region
*

View File

@ -38,26 +38,27 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.azurecompute.arm.domain.Region;
import org.jclouds.azurecompute.arm.features.AvailabilitySetApi;
import org.jclouds.azurecompute.arm.features.DeploymentApi;
import org.jclouds.azurecompute.arm.features.ImageApi;
import org.jclouds.azurecompute.arm.features.LoadBalancerApi;
import org.jclouds.azurecompute.arm.features.LocationApi;
import org.jclouds.azurecompute.arm.features.DiskApi;
import org.jclouds.azurecompute.arm.features.MetricDefinitionsApi;
import org.jclouds.azurecompute.arm.features.MetricsApi;
import org.jclouds.azurecompute.arm.features.NetworkInterfaceCardApi;
import org.jclouds.azurecompute.arm.features.NetworkSecurityGroupApi;
import org.jclouds.azurecompute.arm.features.NetworkSecurityRuleApi;
import org.jclouds.azurecompute.arm.features.OSImageApi;
import org.jclouds.azurecompute.arm.features.PublicIPAddressApi;
import org.jclouds.azurecompute.arm.features.ResourceGroupApi;
import org.jclouds.azurecompute.arm.features.PublicIPAddressApi;
import org.jclouds.azurecompute.arm.features.ResourceProviderApi;
import org.jclouds.azurecompute.arm.features.StorageAccountApi;
import org.jclouds.azurecompute.arm.features.SubnetApi;
import org.jclouds.azurecompute.arm.features.VirtualNetworkApi;
import org.jclouds.azurecompute.arm.features.VMSizeApi;
import org.jclouds.azurecompute.arm.features.VirtualMachineApi;
import org.jclouds.azurecompute.arm.features.VirtualNetworkApi;
import org.jclouds.azurecompute.arm.features.LoadBalancerApi;
import org.jclouds.azurecompute.arm.features.AvailabilitySetApi;
import org.jclouds.azurecompute.arm.features.DiskApi;
import org.jclouds.azurecompute.arm.features.ImageApi;
import org.jclouds.azurecompute.arm.features.MetricDefinitionsApi;
import org.jclouds.azurecompute.arm.features.MetricsApi;
import org.jclouds.azurecompute.arm.features.VirtualMachineScaleSetApi;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
@ -122,6 +123,7 @@ public class AzureComputeProviderMetadata extends BaseProviderMetadata {
properties.put(API_VERSION_PREFIX + ImageApi.class.getSimpleName(), "2016-04-30-preview");
properties.put(API_VERSION_PREFIX + MetricDefinitionsApi.class.getSimpleName(), "2017-05-01-preview");
properties.put(API_VERSION_PREFIX + MetricsApi.class.getSimpleName(), "2016-09-01");
properties.put(API_VERSION_PREFIX + VirtualMachineScaleSetApi.class.getSimpleName(), "2017-03-30");
return properties;
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class Extension {
/**
* The name reference of the extension profile
*/
public abstract String name();
/**
* The properties reference of the extension profile
*/
public abstract ExtensionProperties properties();
@SerializedNames({"name", "properties"})
public static Extension create(final String name, final ExtensionProperties properties) {
return new AutoValue_Extension(name, properties);
}
}

View File

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import org.jclouds.json.SerializedNames;
import java.util.List;
@AutoValue
public abstract class ExtensionProfile {
/**
* The list of extensions of the extension profile
*/
public abstract List<Extension> extensions();
@SerializedNames({"extensions"})
public static ExtensionProfile create(final List<Extension> extensions) {
return new AutoValue_ExtensionProfile(extensions == null ?
ImmutableList.<Extension>of() : ImmutableList.copyOf(extensions));
}
}

View File

@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import org.jclouds.json.SerializedNames;
import java.util.List;
@AutoValue
public abstract class ExtensionProfileSettings {
/**
* The fileUris reference of the extension profile settings
*/
public abstract List<String> fileUris();
/**
* The commandToExecute of the extension profile settings
*/
public abstract String commandToExecute();
@SerializedNames({"fileUris", "commandToExecute"})
public static ExtensionProfileSettings create(final List<String> fileUris, final String commandToExecute) {
return new AutoValue_ExtensionProfileSettings(fileUris == null ? ImmutableList.<String>of() : ImmutableList.copyOf(fileUris), commandToExecute);
}
}

View File

@ -0,0 +1,70 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableMap;
import org.jclouds.json.SerializedNames;
import java.util.Map;
@AutoValue
public abstract class ExtensionProperties {
/**
* The publisher reference of the extension properties
*/
public abstract String publisher();
/**
* The type reference of the extension properties
*/
public abstract String type();
/**
* The typeHandlerVersion reference of the extension properties
*/
public abstract String typeHandlerVersion();
/**
* The autoUpgradeMinorVersion reference of the extension properties
*/
public abstract Boolean autoUpgradeMinorVersion();
/**
* The ExtensionProfileSettings of the extension properties
*/
public abstract ExtensionProfileSettings settings();
/**
* The list of the protectedSettings of the extension properties
*/
public abstract Map<String, String> protectedSettings();
@SerializedNames({ "publisher", "type", "typeHandlerVersion",
"autoUpgradeMinorVersion", "settings", "protectedSettings"})
public static ExtensionProperties create(final String publisher, String type,
final String typeHandlerVersion,
final Boolean autoUpgradeMinorVersion,
final ExtensionProfileSettings settings,
final Map<String, String> protectedSettings) {
return new AutoValue_ExtensionProperties(publisher, type, typeHandlerVersion, autoUpgradeMinorVersion,
settings, protectedSettings == null ?
ImmutableMap.<String, String>of() : ImmutableMap.copyOf(protectedSettings));
}
}

View File

@ -51,6 +51,7 @@ public abstract class NetworkInterfaceCard {
final String location,
final NetworkInterfaceCardProperties properties,
final Map<String, String> tags) {
return new AutoValue_NetworkInterfaceCard(name, id, etag, location, properties, tags == null ? null : ImmutableMap.copyOf(tags));
return new AutoValue_NetworkInterfaceCard(name, id, etag, location, properties,
tags != null ? ImmutableMap.copyOf(tags) : null);
}
}

View File

@ -32,7 +32,8 @@ public abstract class NetworkInterfaceCardProperties implements Provisionable {
@Nullable public abstract List<IpConfiguration> ipConfigurations();
@Nullable public abstract IdReference networkSecurityGroup();
@SerializedNames({"provisioningState", "resourceGuid", "enableIPForwarding", "ipConfigurations", "networkSecurityGroup"})
@SerializedNames({"provisioningState", "resourceGuid", "enableIPForwarding", "ipConfigurations",
"networkSecurityGroup"})
public static NetworkInterfaceCardProperties create(final String provisioningState, final String resourceGuid,
final Boolean enableIPForwarding, final List<IpConfiguration> ipConfigurations,
final IdReference networkSecurityGroup) {

View File

@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class NetworkInterfaceConfiguration {
/**
* The name of the NetworkInterfaceConfiguration
*/
@Nullable
public abstract String name();
/**
* The networkConfigurationProperties of the NetworkInterfaceConfiguration
*/
@Nullable
public abstract NetworkInterfaceConfigurationProperties networkInterfaceConfigurationProperties();
@SerializedNames({"name", "properties"})
public static NetworkInterfaceConfiguration create(
final String name, NetworkInterfaceConfigurationProperties networkInterfaceConfigurationProperties) {
return new AutoValue_NetworkInterfaceConfiguration(name, networkInterfaceConfigurationProperties);
}
}

View File

@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
import java.util.List;
@AutoValue
public abstract class NetworkInterfaceConfigurationProperties {
/**
* The primary of the NetworkInterfaceConfigurationProperties
*/
@Nullable
public abstract Boolean primary();
/**
* The enableAcceleratedNetworking of the NetworkInterfaceConfigurationProperties
*/
@Nullable
public abstract Boolean enableAcceleratedNetworking();
/**
* The networkSecurityGroup of the NetworkInterfaceConfigurationProperties
*/
@Nullable
public abstract VirtualMachineScaleSetNetworkSecurityGroup networkSecurityGroup();
/**
* The dnsSettings of the NetworkInterfaceConfigurationProperties
*/
@Nullable
public abstract VirtualMachineScaleSetDNSSettings dnsSettings();
/**
* The ipConfigurations of the NetworkInterfaceConfigurationProperties
*/
public abstract List<VirtualMachineScaleSetIpConfiguration> ipConfigurations();
@SerializedNames({"primary", "enableAcceleratedNetworking", "networkSecurityGroup", "dnsSettings", "ipConfigurations"})
public static NetworkInterfaceConfigurationProperties create(final Boolean primary,
final Boolean enableAcceleratedNetworking,
final VirtualMachineScaleSetNetworkSecurityGroup networkSecurityGroup,
final VirtualMachineScaleSetDNSSettings dnsSettings,
final List<VirtualMachineScaleSetIpConfiguration> ipConfigurations) {
return new AutoValue_NetworkInterfaceConfigurationProperties(primary, enableAcceleratedNetworking,
networkSecurityGroup, dnsSettings, ipConfigurations);
}
}

View File

@ -45,7 +45,8 @@ public abstract class NetworkSecurityGroupProperties implements Provisionable {
@Nullable
public abstract String provisioningState();
@SerializedNames({"securityRules", "defaultSecurityRules", "networkInterfaces", "subnets", "resourceGuid", "provisioningState"})
@SerializedNames({"securityRules", "defaultSecurityRules", "networkInterfaces", "subnets", "resourceGuid",
"provisioningState"})
public static NetworkSecurityGroupProperties create(final List<NetworkSecurityRule> securityRules,
final List<NetworkSecurityRule> defaultSecurityRules,
final List<NetworkInterfaceCard> networkInterfaces,

View File

@ -69,9 +69,9 @@ public abstract class VirtualMachine {
@SerializedNames({"id", "name", "type", "location", "tags", "properties", "plan"})
public static VirtualMachine create(final String id, final String name, final String type, final String location,
@Nullable final Map<String, String> tags, VirtualMachineProperties properties, @Nullable Plan plan) {
@Nullable final Map<String, String> tags, VirtualMachineProperties properties, @Nullable Plan plan) {
return builder().id(id).name(name).type(type).location(location).tags(tags).properties(properties).plan(plan)
.build();
.build();
}
public abstract Builder toBuilder();

View File

@ -0,0 +1,110 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableMap;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
import java.util.Map;
/**
* VirtualMachineScaleSet for subscription
*/
@AutoValue
public abstract class VirtualMachineScaleSet {
/**
* The id of the virtual machine scale set
*/
@Nullable
public abstract String id();
/**
* The name of the virtual machine scale set
*/
@Nullable
public abstract String name();
/**
* The location of the virtual machine scale set
*/
@Nullable
public abstract String location();
/**
* Specifies the sku of the virtual machine scale set
*/
public abstract VirtualMachineScaleSetSKU sku();
/**
* Specifies the tags of the virtual machine scale set
*/
@Nullable
public abstract Map<String, String> tags();
/**
* Specifies the optional plan of the virtual machine scale set (only for market image)
*/
@Nullable
public abstract VirtualMachineScaleSetPlan plan();
/**
* Specifies the properties of the availability set
*/
@Nullable
public abstract VirtualMachineScaleSetProperties properties();
@SerializedNames({ "id", "name", "location", "sku", "tags", "plan", "properties"})
public static VirtualMachineScaleSet create(final String id, final String name, final String location,
VirtualMachineScaleSetSKU sku, final Map<String, String> tags,
VirtualMachineScaleSetPlan plan,
VirtualMachineScaleSetProperties properties) {
return builder().id(id).name(name).location(location).sku(sku).tags(tags)
.plan(plan).properties(properties)
.build();
}
public abstract Builder toBuilder();
private static Builder builder() {
return new AutoValue_VirtualMachineScaleSet.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder id(String id);
public abstract Builder name(String name);
public abstract Builder location(String location);
public abstract Builder sku(VirtualMachineScaleSetSKU sku);
public abstract Builder tags(Map<String, String> tags);
public abstract Builder plan(VirtualMachineScaleSetPlan plan);
public abstract Builder properties(VirtualMachineScaleSetProperties properties);
abstract Map<String, String> tags();
abstract VirtualMachineScaleSet autoBuild();
public VirtualMachineScaleSet build() {
tags(tags() != null ? ImmutableMap.copyOf(tags()) : null);
return autoBuild();
}
}
}

View File

@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import org.jclouds.json.SerializedNames;
import java.util.List;
/**
* VirtualMachineScaleSetDNSSettings
*/
@AutoValue
public abstract class VirtualMachineScaleSetDNSSettings {
/**
* The list of DNS servers of the Virtual Machine Scale Set DNS Settings
*/
public abstract List<String> dnsServers();
@SerializedNames({"dnsServers"})
public static VirtualMachineScaleSetDNSSettings create(final List<String> dnsServers) {
return new AutoValue_VirtualMachineScaleSetDNSSettings(
dnsServers == null ? ImmutableList.<String>of() : ImmutableList.copyOf(dnsServers));
}
}

View File

@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class VirtualMachineScaleSetIpConfiguration {
/**
* The name of the Virtual Machine Scale Set Ip Configuration
*/
@Nullable
public abstract String name();
/**
* The properties of the Virtual Machine Scale Set Ip Configuration
*/
@Nullable
public abstract VirtualMachineScaleSetIpConfigurationProperties properties();
@SerializedNames({"name", "properties"})
public static VirtualMachineScaleSetIpConfiguration create(
final String name,
final VirtualMachineScaleSetIpConfigurationProperties properties) {
return builder()
.name(name)
.properties(properties)
.build();
}
public abstract Builder toBuilder();
public static Builder builder() {
return new AutoValue_VirtualMachineScaleSetIpConfiguration.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder name(String name);
public abstract Builder properties(VirtualMachineScaleSetIpConfigurationProperties properties);
public abstract VirtualMachineScaleSetIpConfiguration build();
}
}

View File

@ -0,0 +1,118 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
import java.util.List;
@AutoValue
public abstract class VirtualMachineScaleSetIpConfigurationProperties {
/**
* The public IP address configuration of the Virtual Machine Scale Set Ip Configuration Properties
*/
@Nullable
public abstract VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration();
/**
* The subnet of the Virtual Machine Scale Set Ip Configuration Properties
*/
public abstract Subnet subnet();
/**
* The private IP address version of the Virtual Machine Scale Set Ip Configuration Properties
*/
@Nullable
public abstract String privateIPAddressVersion();
/**
* The load balancer backend address pools of the Virtual Machine Scale Set Ip Configuration Properties
*/
public abstract List<IdReference> loadBalancerBackendAddressPools();
/**
* The load balancer inbound nat pools of the Virtual Machine Scale Set Ip Configuration Properties
*/
public abstract List<IdReference> loadBalancerInboundNatPools();
/**
* The application gateway backend address Pools of the Virtual Machine Scale Set Ip Configuration Properties
*/
@Nullable
public abstract String applicationGatewayBackendAddressPools();
@SerializedNames({"publicIPAddressConfiguration", "subnet", "privateIPAddressVersion",
"loadBalancerBackendAddressPools", "loadBalancerInboundNatPools", "applicationGatewayBackendAddressPools"})
public static VirtualMachineScaleSetIpConfigurationProperties create(
final VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration,
final Subnet subnet,
final String privateIPAddressVersion,
final List<IdReference> loadBalancerBackendAddressPools,
final List<IdReference> loadBalancerInboundNatPools,
final String applicationGatewayBackendAddressPools)
{
return builder()
.publicIPAddressConfiguration(publicIPAddressConfiguration)
.subnet(subnet)
.privateIPAddressVersion(privateIPAddressVersion)
.lbBackendAddressPools(loadBalancerBackendAddressPools)
.lbInboundNatPools(loadBalancerInboundNatPools)
.applicationGatewayBackendAddressPools(applicationGatewayBackendAddressPools)
.build();
}
public abstract Builder toBuilder();
public static Builder builder() {
return new AutoValue_VirtualMachineScaleSetIpConfigurationProperties.Builder()
.lbBackendAddressPools(null)
.lbInboundNatPools(null);
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder publicIPAddressConfiguration(VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration);
public abstract Builder subnet(Subnet subnet);
public abstract Builder loadBalancerBackendAddressPools(List<IdReference> loadBalancerBackendAddressPools);
public abstract Builder loadBalancerInboundNatPools(List<IdReference> loadBalancerInboundNatPools);
public abstract Builder privateIPAddressVersion(String privateIPAddressVersion);
public Builder lbBackendAddressPools(List<IdReference> loadBalancerBackendAddressPools) {
return loadBalancerBackendAddressPools(loadBalancerBackendAddressPools != null ? ImmutableList
.copyOf(loadBalancerBackendAddressPools) : ImmutableList.<IdReference>of());
}
public Builder lbInboundNatPools(List<IdReference> loadBalancerInboundNatPools) {
return loadBalancerInboundNatPools(loadBalancerInboundNatPools != null ? ImmutableList
.copyOf(loadBalancerInboundNatPools) : ImmutableList.<IdReference>of());
}
public abstract Builder applicationGatewayBackendAddressPools(String applicationGatewayBackendAddressPools);
public abstract VirtualMachineScaleSetIpConfigurationProperties build();
}
}

View File

@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import org.jclouds.json.SerializedNames;
import java.util.List;
@AutoValue
public abstract class VirtualMachineScaleSetNetworkProfile {
/**
* The network interface configurations of the Virtual Machine Scale Set Network Profile
*/
public abstract List<NetworkInterfaceConfiguration> networkInterfaceConfigurations();
@SerializedNames({"networkInterfaceConfigurations"})
public static VirtualMachineScaleSetNetworkProfile create(
final List<NetworkInterfaceConfiguration> networkInterfaceConfigurations) {
return builder()
.networkInterfaceConfigurations(networkInterfaceConfigurations == null ?
ImmutableList.<NetworkInterfaceConfiguration>of() : ImmutableList.copyOf(networkInterfaceConfigurations) )
.build();
}
public abstract Builder toBuilder();
public static Builder builder() {
return new AutoValue_VirtualMachineScaleSetNetworkProfile.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder networkInterfaceConfigurations(
List<NetworkInterfaceConfiguration> networkInterfaceConfigurations);
public abstract VirtualMachineScaleSetNetworkProfile build();
}
}

View File

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
/**
* Virtual Machine Scale Set Network Security Group
*/
@AutoValue
public abstract class VirtualMachineScaleSetNetworkSecurityGroup {
/**
* The id of the Virtual Machine Scale Set Network Security Group
*/
@Nullable
public abstract String id();
@SerializedNames({"id"})
public static VirtualMachineScaleSetNetworkSecurityGroup create(final String id) {
return new AutoValue_VirtualMachineScaleSetNetworkSecurityGroup(id);
}
}

View File

@ -0,0 +1,277 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import org.jclouds.azurecompute.arm.util.GetEnumValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
import java.util.List;
@AutoValue
public abstract class VirtualMachineScaleSetOSProfile {
@AutoValue
public abstract static class LinuxConfiguration {
@AutoValue
public abstract static class SSH {
@AutoValue
public abstract static class SSHPublicKey {
/**
* The path for the SSH public key
*/
@Nullable
public abstract String path();
/**
* The key data for the SSH public key
*/
@Nullable
public abstract String keyData();
@SerializedNames({"path", "keyData"})
public static SSHPublicKey create(final String path, final String keyData) {
return new AutoValue_VirtualMachineScaleSetOSProfile_LinuxConfiguration_SSH_SSHPublicKey(
path, keyData);
}
}
/**
* The list of public keys and paths
*/
@Nullable
public abstract List<SSHPublicKey> publicKeys();
@SerializedNames({"publicKeys"})
public static SSH create(final List<SSHPublicKey> publicKeys) {
return new AutoValue_VirtualMachineScaleSetOSProfile_LinuxConfiguration_SSH(
publicKeys);
}
}
/**
* The authentication method password or ssh
*/
public abstract Boolean disablePasswordAuthentication();
/**
* ssh keys
*/
@Nullable
public abstract SSH ssh();
@SerializedNames({"disablePasswordAuthentication", "ssh"})
public static LinuxConfiguration create(final Boolean disablePasswordAuthentication,
final SSH ssh) {
return new AutoValue_VirtualMachineScaleSetOSProfile_LinuxConfiguration(disablePasswordAuthentication,
ssh);
}
}
@AutoValue
public abstract static class WindowsConfiguration {
@AutoValue
public abstract static class WinRM {
public enum Protocol {
HTTP("http"),
HTTPS("https"),
UNRECOGNIZED("Unrecognized");
private String value;
Protocol(String value) {
this.value = value;
}
public static Protocol fromValue(String value) {
return (Protocol) GetEnumValue.fromValueOrDefault(value, Protocol.UNRECOGNIZED);
}
@Override
public String toString() {
return this.value;
}
}
@AutoValue
public abstract static class ProtocolListener {
/**
* The protocol for the protcol listener
*/
public abstract Protocol protocol();
/**
* The certificate url or the protcol listener
*/
@Nullable
public abstract String certificateUrl();
@SerializedNames({"protocol", "certificateUrl"})
public static ProtocolListener create(final Protocol protocol, final String certificateUrl) {
return new AutoValue_VirtualMachineScaleSetOSProfile_WindowsConfiguration_WinRM_ProtocolListener(
protocol, certificateUrl);
}
}
/**
* Map of different settings
*/
public abstract List<ProtocolListener> listeners();
@SerializedNames({"listeners"})
public static WinRM create(final List<ProtocolListener> listeners) {
return new AutoValue_VirtualMachineScaleSetOSProfile_WindowsConfiguration_WinRM(listeners == null ? ImmutableList.<ProtocolListener>of() : ImmutableList.copyOf(listeners));
}
}
@AutoValue
public abstract static class AdditionalUnattendContent {
public abstract String pass();
public abstract String component();
public abstract String settingName();
public abstract String content();
@SerializedNames({"pass", "component", "settingName", "content"})
public static AdditionalUnattendContent create(final String pass, final String component,
final String settingName,
final String content) {
return new AutoValue_VirtualMachineScaleSetOSProfile_WindowsConfiguration_AdditionalUnattendContent(
pass, component, settingName, content);
}
}
/**
* The provision VM Agent true of false.
*/
public abstract boolean provisionVMAgent();
/**
* winRM
*/
@Nullable
public abstract WinRM winRM();
/**
* unattend content
*/
public abstract List<AdditionalUnattendContent> additionalUnattendContent();
/**
* is automatic updates enabled
*/
public abstract boolean enableAutomaticUpdates();
@SerializedNames({"provisionVMAgent", "winRM", "additionalUnattendContent", "enableAutomaticUpdates"})
public static WindowsConfiguration create(final boolean provisionVMAgent, final WinRM winRM,
final List<AdditionalUnattendContent> additionalUnattendContent,
final boolean enableAutomaticUpdates) {
return new AutoValue_VirtualMachineScaleSetOSProfile_WindowsConfiguration(provisionVMAgent, winRM,
additionalUnattendContent == null ? ImmutableList.<AdditionalUnattendContent>of() : ImmutableList.copyOf(additionalUnattendContent), enableAutomaticUpdates);
}
}
/**
* The computer name of the VM
*/
@Nullable
public abstract String computerNamePrefix();
/**
* The admin username of the VM
*/
@Nullable
public abstract String adminUsername();
/**
* The admin password of the VM
*/
@Nullable
public abstract String adminPassword();
/**
* The linux configuration of the VM
*/
@Nullable
public abstract LinuxConfiguration linuxConfiguration();
/**
* The windows configuration of the VM
*/
@Nullable
public abstract WindowsConfiguration windowsConfiguration();
/**
* The Secrets configuration of the VM
*/
public abstract List<Secrets> secrets();
@SerializedNames({"computerNamePrefix", "adminUsername", "adminPassword", "linuxConfiguration",
"windowsConfiguration", "secrets"})
public static VirtualMachineScaleSetOSProfile create(final String computerNamePrefix, final String adminUsername,
final String adminPassword, final LinuxConfiguration linuxConfiguration,
final WindowsConfiguration windowsConfiguration, final List<Secrets> secrets) {
return builder()
.computerNamePrefix(computerNamePrefix)
.adminUsername(adminUsername)
.adminPassword(adminPassword)
.linuxConfiguration(linuxConfiguration)
.windowsConfiguration(windowsConfiguration)
._secrets(secrets)
.build();
}
public abstract Builder toBuilder();
public static Builder builder() {
return new AutoValue_VirtualMachineScaleSetOSProfile.Builder()._secrets(null);
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder computerNamePrefix(String computerNamePrefix);
public abstract Builder adminUsername(String adminUsername);
public abstract Builder adminPassword(String adminPassword);
public abstract Builder linuxConfiguration(LinuxConfiguration linuxConfiguration);
public abstract Builder windowsConfiguration(WindowsConfiguration windowsConfiguration);
public abstract Builder secrets(List<Secrets> secrets);
public Builder _secrets(List<Secrets> secrets) {
return secrets(secrets != null ? ImmutableList.copyOf(secrets) : ImmutableList.<Secrets>of());
}
public abstract VirtualMachineScaleSetOSProfile build();
}
}

View File

@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
/**
* SKU
*/
@AutoValue
public abstract class VirtualMachineScaleSetPlan {
/**
* The name of the Virtual Machine Scale Set Plan
*/
@Nullable
public abstract String name();
/**
* The publisher of the Virtual Machine Scale Set Plan
*/
@Nullable
public abstract String publisher();
/**
* The product of the Virtual Machine Scale Set Plan
*/
@Nullable
public abstract String product();
@SerializedNames({"name", "publisher", "product"})
public static VirtualMachineScaleSetPlan create(final String name, final String publisher, final String product) {
return new AutoValue_VirtualMachineScaleSetPlan(name, publisher, product);
}
}

View File

@ -0,0 +1,106 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.azurecompute.arm.util.GetEnumValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class VirtualMachineScaleSetProperties {
public enum ProvisioningState {
ACCEPTED,
CREATING,
READY,
CANCELED,
FAILED,
DELETED,
SUCCEEDED,
RUNNING,
UPDATING,
UNRECOGNIZED;
public static ProvisioningState fromValue(final String text) {
return (ProvisioningState) GetEnumValue.fromValueOrDefault(text, ProvisioningState.UNRECOGNIZED);
}
}
/**
* The singlePlacementGroup of the VirtualMachineScaleSetProperties
*/
@Nullable
public abstract Boolean singlePlacementGroup();
/**
* Specifies the over provision of the virtual machine scale set
*/
@Nullable
public abstract Boolean overProvision();
/**
* Specifies the upgrade policy of the virtual machine scale set
*/
public abstract VirtualMachineScaleSetUpgradePolicy upgradePolicy();
/**
* Specifies the state of the provision of the virtual machine scale set
*/
@Nullable
public abstract ProvisioningState provisioningState();
/**
* Specifies the virtual machine profile of the virtual machine scale set
*/
public abstract VirtualMachineScaleSetVirtualMachineProfile virtualMachineProfile();
@SerializedNames({"singlePlacementGroup", "overProvision", "upgradePolicy", "provisioningState", "virtualMachineProfile"})
public static VirtualMachineScaleSetProperties create(
final Boolean singlePlacementGroup,
final Boolean overProvision,
final VirtualMachineScaleSetUpgradePolicy upgradePolicy,
final ProvisioningState provisioningState,
final VirtualMachineScaleSetVirtualMachineProfile virtualMachineProfile) {
return builder().singlePlacementGroup(singlePlacementGroup).overProvision(overProvision).
upgradePolicy(upgradePolicy).provisioningState(provisioningState).virtualMachineProfile(virtualMachineProfile).build();
}
public abstract Builder toBuilder();
private static Builder builder() {
return new AutoValue_VirtualMachineScaleSetProperties.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder singlePlacementGroup(Boolean singlePlacementGroup);
public abstract Builder overProvision(Boolean overProvision);
public abstract Builder upgradePolicy(VirtualMachineScaleSetUpgradePolicy upgradePolicy);
public abstract Builder provisioningState(ProvisioningState provisioningState);
public abstract Builder virtualMachineProfile(VirtualMachineScaleSetVirtualMachineProfile virtualMachineProfile);
public abstract VirtualMachineScaleSetProperties build();
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class VirtualMachineScaleSetPublicIPAddressConfiguration {
/**
* The name of the Virtual Machine Scale Set Public IP Address Configuration
*/
public abstract String name();
/**
* The properties of the Virtual Machine Scale Set Public IP Address Configuration
*/
public abstract VirtualMachineScaleSetPublicIPAddressProperties properties();
@SerializedNames({ "name", "properties" })
public static VirtualMachineScaleSetPublicIPAddressConfiguration create(
String name,
VirtualMachineScaleSetPublicIPAddressProperties properties) {
return builder().name(name).properties(properties).build();
}
VirtualMachineScaleSetPublicIPAddressConfiguration() {
}
public abstract Builder toBuilder();
public static Builder builder() {
return new AutoValue_VirtualMachineScaleSetPublicIPAddressConfiguration.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder name(String name);
public abstract Builder properties(VirtualMachineScaleSetPublicIPAddressProperties properties);
public abstract VirtualMachineScaleSetPublicIPAddressConfiguration build();
}
}

View File

@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class VirtualMachineScaleSetPublicIPAddressProperties {
/**
* The idle timeout (in minutes) of the Virtual Machine Scale Set Public IP Address Configuration
*/
@Nullable
public abstract Integer idleTimeoutInMinutes();
@SerializedNames({ "idleTimeoutInMinutes" })
public static VirtualMachineScaleSetPublicIPAddressProperties create(final Integer idleTimeoutInMinutes) {
return builder()
.idleTimeoutInMinutes(idleTimeoutInMinutes)
.build();
}
public abstract Builder toBuilder();
public static Builder builder() {
return new AutoValue_VirtualMachineScaleSetPublicIPAddressProperties.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder idleTimeoutInMinutes(Integer idleTimeoutInMinutes);
public abstract VirtualMachineScaleSetPublicIPAddressProperties build();
}
}

View File

@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class VirtualMachineScaleSetSKU {
/**
* The name of the Virtual Machine Scale Set SKU
*/
public abstract String name();
/**
* The tier of the Virtual Machine Scale Set SKU
*/
public abstract String tier();
/**
* The capacity of the Virtual Machine Scale Set SKU
*/
public abstract int capacity();
@SerializedNames({"name", "tier", "capacity"})
public static VirtualMachineScaleSetSKU create(final String name, final String tier, final int capacity) {
return new AutoValue_VirtualMachineScaleSetSKU(name, tier, capacity);
}
}

View File

@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import org.jclouds.azurecompute.arm.util.GetEnumValue;
public class VirtualMachineScaleSetUpgradeMode {
/**
* VirtualMachineScaleSetUpgradeMode
* **/
public enum Status {
Manual,
Automatic,
Unrecognized;
public static Status fromValue(final String text) {
return (Status) GetEnumValue.fromValueOrDefault(text, Status.Unrecognized);
}
}
}

View File

@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.json.SerializedNames;
@AutoValue
public abstract class VirtualMachineScaleSetUpgradePolicy {
/**
* The mode of the Virtual Machine Scale Set Upgrade Policy
*/
public abstract String mode();
@SerializedNames({"mode"})
public static VirtualMachineScaleSetUpgradePolicy create(final String mode) {
return new AutoValue_VirtualMachineScaleSetUpgradePolicy(mode);
}
}

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.domain;
import com.google.auto.value.AutoValue;
import org.jclouds.json.SerializedNames;
/**
* A virtual machine properties for the virtual machine.
*/
@AutoValue
public abstract class VirtualMachineScaleSetVirtualMachineProfile {
/**
* The storage profile of the Virtual Machine Scale Set Virtual Machine Profile.
*/
public abstract StorageProfile storageProfile();
/**
* The OS profile of the Virtual Machine Scale Set Virtual Machine Profile.
*/
public abstract VirtualMachineScaleSetOSProfile osProfile();
/**
* The network profile of the Virtual Machine Scale Set Virtual Machine Profile
*/
public abstract VirtualMachineScaleSetNetworkProfile networkProfile();
/**
* The extension profile of the Virtual Machine Scale Set Virtual Machine Profile .
*/
public abstract ExtensionProfile extensionProfile();
@SerializedNames({"storageProfile", "osProfile", "networkProfile", "extensionProfile"})
public static VirtualMachineScaleSetVirtualMachineProfile create(
final StorageProfile storageProfile,
final VirtualMachineScaleSetOSProfile osProfile,
final VirtualMachineScaleSetNetworkProfile networkProfile,
final ExtensionProfile extensionProfile) {
return builder()
.storageProfile(storageProfile)
.osProfile(osProfile)
.networkProfile(networkProfile)
.extensionProfile(extensionProfile)
.build();
}
public abstract Builder toBuilder();
public static Builder builder() {
return new AutoValue_VirtualMachineScaleSetVirtualMachineProfile.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder storageProfile(StorageProfile storageProfile);
public abstract Builder osProfile(VirtualMachineScaleSetOSProfile osProfile);
public abstract Builder networkProfile(VirtualMachineScaleSetNetworkProfile networkProfile);
public abstract Builder extensionProfile(ExtensionProfile extensionProfile);
public abstract VirtualMachineScaleSetVirtualMachineProfile build();
}
}

View File

@ -0,0 +1,88 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.features;
import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSet;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetProperties;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetSKU;
import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
import org.jclouds.azurecompute.arm.functions.URIParser;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.filters.OAuthFilter;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.binders.BindToJsonPayload;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType;
import java.io.Closeable;
import java.net.URI;
import java.util.List;
import java.util.Map;
/**
* The Virtual Machine Scale Set API includes operations for managing the virtual machines in your subscription.
*
* @see <a href="https://docs.microsoft.com/en-us/rest/api/virtualmachinescalesets/">docs</a>
*/
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/VirtualMachineScaleSets")
@RequestFilters({OAuthFilter.class, ApiVersionFilter.class})
@Consumes(MediaType.APPLICATION_JSON)
public interface VirtualMachineScaleSetApi extends Closeable {
@Named("virtualmachinescaleset:list")
@GET
@SelectJson("value")
@Fallback(EmptyListOnNotFoundOr404.class)
List<VirtualMachineScaleSet> list();
@Named("virtualmachinescaleset:get")
@Path("/{name}")
@GET
@Fallback(NullOnNotFoundOr404.class)
VirtualMachineScaleSet get(@PathParam("name") String name);
@Named("virtualmachinescaleset:createOrUpdate")
@MapBinder(BindToJsonPayload.class)
@Path("/{name}")
@PUT
VirtualMachineScaleSet createOrUpdate(@PathParam("name") String name,
@PayloadParam("location") String location,
@PayloadParam("sku") VirtualMachineScaleSetSKU sku,
@Nullable @PayloadParam("tags") Map<String, String> tags,
@PayloadParam("properties") VirtualMachineScaleSetProperties properties);
@Named("virtualmachinescaleset:delete")
@Path("/{name}")
@DELETE
@ResponseParser(URIParser.class)
@Fallback(NullOnNotFoundOr404.class)
URI delete(@PathParam("name") String name);
}

View File

@ -0,0 +1,297 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.features;
import com.google.common.collect.ImmutableMap;
import org.jclouds.azurecompute.arm.domain.DataDisk;
import org.jclouds.azurecompute.arm.domain.Extension;
import org.jclouds.azurecompute.arm.domain.ExtensionProfile;
import org.jclouds.azurecompute.arm.domain.ExtensionProfileSettings;
import org.jclouds.azurecompute.arm.domain.ExtensionProperties;
import org.jclouds.azurecompute.arm.domain.IdReference;
import org.jclouds.azurecompute.arm.domain.ImageReference;
import org.jclouds.azurecompute.arm.domain.IpConfiguration;
import org.jclouds.azurecompute.arm.domain.IpConfigurationProperties;
import org.jclouds.azurecompute.arm.domain.ManagedDiskParameters;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceCard;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceCardProperties;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceConfiguration;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceConfigurationProperties;
import org.jclouds.azurecompute.arm.domain.NetworkProfile;
import org.jclouds.azurecompute.arm.domain.OSDisk;
import org.jclouds.azurecompute.arm.domain.StorageProfile;
import org.jclouds.azurecompute.arm.domain.Subnet;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSet;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetDNSSettings;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetIpConfiguration;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetIpConfigurationProperties;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetNetworkProfile;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetNetworkSecurityGroup;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetOSProfile;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetProperties;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetPublicIPAddressConfiguration;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetPublicIPAddressProperties;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetSKU;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetUpgradePolicy;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetVirtualMachineProfile;
import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
@Test(groups = "live", testName = "VirtualMachineScaleSetApiLiveTest")
public class VirtualMachineScaleSetApiLiveTest extends BaseAzureComputeApiLiveTest {
private String subscriptionid;
private String vmssName;
private VirtualMachineScaleSetSKU SKU;
private String nicName;
private String virtualNetworkName;
private String subnetId;
private Subnet subnet;
@BeforeClass
@Override
public void setup() {
super.setup();
subscriptionid = getSubscriptionId();
createTestResourceGroup(); //BASE: Creates a random resource group using the properties location
virtualNetworkName = String.format("vn-%s-%s", this.getClass().getSimpleName().toLowerCase(), System.getProperty("user.name"));
// Subnets belong to a virtual network so that needs to be created first
assertNotNull(createDefaultVirtualNetwork(resourceGroupName, virtualNetworkName, "10.2.0.0/16", LOCATION));
//Subnet needs to be up & running before NIC can be created
String subnetName = String.format("s-%s-%s", this.getClass().getSimpleName().toLowerCase(), System.getProperty("user.name"));
this.subnet = createDefaultSubnet(resourceGroupName, subnetName, virtualNetworkName, "10.2.0.0/23");
assertNotNull(subnet);
assertNotNull(subnet.id());
this.subnetId = subnet.id();
vmssName = String.format("%3.24s", System.getProperty("user.name") + RAND + this.getClass().getSimpleName()).toLowerCase().substring(0, 15);
}
private VirtualMachineScaleSetApi api() {
return api.getVirtualMachineScaleSetApi(resourceGroupName);
}
@Test
public void testCreate() {
VirtualMachineScaleSet vmss = api().createOrUpdate(vmssName, LOCATIONDESCRIPTION, getSKU(),
Collections.<String, String>emptyMap(), getProperties());
assertTrue(!vmss.name().isEmpty());
// waitUntilReady(vmssName);
}
@Test(dependsOnMethods = "testCreate")
public void testList() throws InterruptedException {
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourceGroupName);
assertEquals(vmssAPI.list().size(), 1);
}
@Test(dependsOnMethods = "testList")
public void testGet() {
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourceGroupName);
assertEquals(vmssAPI.get(vmssName).name(), vmssName);
}
@Test(dependsOnMethods = "testGet", alwaysRun = true)
public void testDelete() throws Exception {
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourceGroupName);
URI uri = vmssAPI.delete(vmssName);
assertResourceDeleted(uri);
}
protected void assertResourceDeleted(URI uri) {
if (uri != null) {
assertTrue(resourceDeleted.apply(uri),
String.format("Resource %s was not terminated in the configured timeout", uri));
}
}
/**
* Create a standard SKU
*
* @return VirtualMachineScaleSetSKU
*/
public VirtualMachineScaleSetSKU getSKU() {
return VirtualMachineScaleSetSKU.create("Standard_A1", "Standard", 10);
}
private VirtualMachineScaleSetUpgradePolicy getUpgradePolicy() {
return VirtualMachineScaleSetUpgradePolicy.create("Manual");
}
private List<DataDisk> getDataDisks() {
List<DataDisk> datadisks = new ArrayList<DataDisk>();
datadisks.add(DataDisk.create(null, "10", 1, null,
null, "FromImage",
"None", getManagedDiskParameters(),
null));
return datadisks;
}
private StorageProfile getStorageProfile() {
return StorageProfile.create(getWindowsImageReference(), getWindowsOSDisk(), getDataDisks());
}
private StorageProfile getWindowsStorageProfile_Default() {
return StorageProfile.create(getWindowsImageReference(), getWindowsOSDisk(), null);
}
private StorageProfile getLinuxStorageProfile_Default() {
return StorageProfile.create(getLinuxImageReference(), getLinuxOSDisk(), null);
}
private ManagedDiskParameters getManagedDiskParameters() {
return ManagedDiskParameters.create(null, "Standard_LRS");
}
private OSDisk getWindowsOSDisk() {
return OSDisk.create("Windows", null, null, null, "FromImage",
null, getManagedDiskParameters(), null);
}
private OSDisk getLinuxOSDisk() {
return OSDisk.create("Linux", null, null, null, "FromImage",
null, getManagedDiskParameters(), null);
}
private ImageReference getWindowsImageReference() {
return ImageReference.create(null, "Microsoft.Windows", "Windows2016",
"Enterprise", "latest");
}
private ImageReference getLinuxImageReference() {
return ImageReference.create(null, "Canonical", "UbuntuServer",
"16.04-LTS", "latest");
}
private VirtualMachineScaleSetOSProfile getOSProfile() {
VirtualMachineScaleSetOSProfile.LinuxConfiguration linuxConfiguration =
VirtualMachineScaleSetOSProfile.LinuxConfiguration.create(false, null);
VirtualMachineScaleSetOSProfile.WindowsConfiguration windowsConfiguration = null;
return VirtualMachineScaleSetOSProfile.create(vmssName, "jclouds", "jClouds1!",
linuxConfiguration, windowsConfiguration, null);
}
private VirtualMachineScaleSetNetworkProfile getNetworkProfile() {
List<NetworkProfile.NetworkInterface> networkInterfacesList = new ArrayList<NetworkProfile.NetworkInterface>();
NetworkInterfaceCard nic = createNetworkInterfaceCard(resourceGroupName, "jc-nic-" + RAND, LOCATION, "ipConfig-" + RAND);
assertNotNull(nic);
networkInterfacesList.add(NetworkProfile.NetworkInterface.create(nic.id(), NetworkProfile.NetworkInterface.NetworkInterfaceProperties.create(true)));
List<NetworkInterfaceConfiguration> networkInterfaceConfigurations = new ArrayList<NetworkInterfaceConfiguration>();
List<VirtualMachineScaleSetIpConfiguration> virtualMachineScaleSetIpConfigurations = new ArrayList<VirtualMachineScaleSetIpConfiguration>();
VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration =
VirtualMachineScaleSetPublicIPAddressConfiguration.create("pub1", VirtualMachineScaleSetPublicIPAddressProperties.create(15));
VirtualMachineScaleSetIpConfigurationProperties virtualMachineScaleSetIpConfigurationProperties =
VirtualMachineScaleSetIpConfigurationProperties.create(publicIPAddressConfiguration,
this.subnet, "IPv4", null,
null, null);
VirtualMachineScaleSetIpConfiguration virtualMachineScaleSetIpConfiguration =
VirtualMachineScaleSetIpConfiguration.create("ipconfig1", virtualMachineScaleSetIpConfigurationProperties);
virtualMachineScaleSetIpConfigurations.add(virtualMachineScaleSetIpConfiguration);
VirtualMachineScaleSetNetworkSecurityGroup networkSecurityGroup = null;
ArrayList<String> dnsList = new ArrayList<String>();
dnsList.add("8.8.8.8");
VirtualMachineScaleSetDNSSettings dnsSettings = VirtualMachineScaleSetDNSSettings.create(dnsList);
NetworkInterfaceConfigurationProperties networkInterfaceConfigurationProperties =
NetworkInterfaceConfigurationProperties.create(true, false, networkSecurityGroup, dnsSettings, virtualMachineScaleSetIpConfigurations);
NetworkInterfaceConfiguration networkInterfaceConfiguration = NetworkInterfaceConfiguration.create("nicconfig1", networkInterfaceConfigurationProperties);
networkInterfaceConfigurations.add(networkInterfaceConfiguration);
return VirtualMachineScaleSetNetworkProfile.create(networkInterfaceConfigurations);
}
private ExtensionProfile getExtensionProfile() {
List<Extension> extensions = new ArrayList<Extension>();
List<String> uris = new ArrayList<String>();
uris.add("https://mystorage1.blob.core.windows.net/winvmextekfacnt/SampleCmd_1.cmd");
ExtensionProfileSettings extensionProfileSettings = ExtensionProfileSettings.create(uris, "SampleCmd_1.cmd");
Map<String, String> protectedSettings = new HashMap<String, String>();
protectedSettings.put("StorageAccountKey", "jclouds-accountkey");
ExtensionProperties extensionProperties = ExtensionProperties.create("Microsoft.compute", "CustomScriptExtension",
"1.1", false, extensionProfileSettings,
protectedSettings);
Extension extension = Extension.create("extensionName", extensionProperties);
extensions.add(extension);
return ExtensionProfile.create(extensions);
}
private VirtualMachineScaleSetVirtualMachineProfile getVirtualMachineProfile() {
return VirtualMachineScaleSetVirtualMachineProfile.create(getLinuxStorageProfile_Default(), getOSProfile(), getNetworkProfile(), getExtensionProfile());
}
public VirtualMachineScaleSetProperties getProperties() {
return VirtualMachineScaleSetProperties.create(null, null, getUpgradePolicy(), null, getVirtualMachineProfile());
}
private NetworkInterfaceCard createNetworkInterfaceCard(final String resourceGroupName, String networkInterfaceCardName, String locationName, String ipConfigurationName) {
//Create properties object
final NetworkInterfaceCardProperties networkInterfaceCardProperties = NetworkInterfaceCardProperties
.builder()
.ipConfigurations(
Arrays.asList(IpConfiguration.create(ipConfigurationName, null, null, null, IpConfigurationProperties
.create(null, null, "Dynamic", IdReference.create(subnetId), null, null, null)))).build();
final Map<String, String> tags = ImmutableMap.of("jclouds", "livetest");
return api.getNetworkInterfaceCardApi(resourceGroupName).createOrUpdate(networkInterfaceCardName, locationName, networkInterfaceCardProperties, tags);
}
public String getSubscriptionid() {
return subscriptionid;
}
}

View File

@ -0,0 +1,453 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azurecompute.arm.features;
import com.google.common.collect.ImmutableMap;
import org.jclouds.azurecompute.arm.domain.DataDisk;
import org.jclouds.azurecompute.arm.domain.Extension;
import org.jclouds.azurecompute.arm.domain.ExtensionProfile;
import org.jclouds.azurecompute.arm.domain.ExtensionProfileSettings;
import org.jclouds.azurecompute.arm.domain.ExtensionProperties;
import org.jclouds.azurecompute.arm.domain.IdReference;
import org.jclouds.azurecompute.arm.domain.ImageReference;
import org.jclouds.azurecompute.arm.domain.ManagedDiskParameters;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceCard;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceCardProperties;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceConfiguration;
import org.jclouds.azurecompute.arm.domain.NetworkInterfaceConfigurationProperties;
import org.jclouds.azurecompute.arm.domain.NetworkProfile;
import org.jclouds.azurecompute.arm.domain.OSDisk;
import org.jclouds.azurecompute.arm.domain.Secrets;
import org.jclouds.azurecompute.arm.domain.StorageProfile;
import org.jclouds.azurecompute.arm.domain.Subnet;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSet;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetDNSSettings;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetIpConfiguration;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetIpConfigurationProperties;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetNetworkProfile;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetOSProfile;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetProperties;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetPublicIPAddressConfiguration;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetPublicIPAddressProperties;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetSKU;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetUpgradePolicy;
import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetVirtualMachineProfile;
import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.google.common.collect.Iterables.isEmpty;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
@Test(groups = "unit", testName = "VirtualMachineScaleSetAPIMockTest", singleThreaded = true)
public class VirtualMachineScaleSetApiMockTest extends BaseAzureComputeApiMockTest {
private final String resourcegroup = "myresourcegroup";
private final String vmssname = "jclouds-vmssname";
public void testGet() throws InterruptedException {
server.enqueue(jsonResponse("/virtualmachinescalesetget.json").setResponseCode(200));
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup);
assertEquals(vmssAPI.get(vmssname).name(), vmssname);
assertSent(server,
"GET", "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/" +
"providers/Microsoft.Compute"
+ "/VirtualMachineScaleSets/jclouds-vmssname?api-version=2017-03-30");
}
public void testGetWhen404() throws InterruptedException {
server.enqueue(jsonResponse("/virtualmachinescalesetgetwhen404.json").setResponseCode(404));
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup);
VirtualMachineScaleSet vmss = vmssAPI.get(vmssname + 1);
assertSent(server,
"GET",
"/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" +
"Microsoft.Compute/VirtualMachineScaleSets/" +
vmssname + "1?api-version=2017-03-30");
assertNull(vmss);
}
public void testCreateOrUpdate() throws InterruptedException {
server.enqueue(
jsonResponse(
"/virtualmachinescalesetresponsecreateorupdate.json").setResponseCode(200));
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup);
VirtualMachineScaleSet vmss = CreateOrUpdateVMSS(vmssAPI);
assertNotNull(vmss);
assertSent(server,
"PUT",
"/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" +
"Microsoft.Compute"
+ "/VirtualMachineScaleSets/" + vmssname + "?api-version=2017-03-30",
"{\n" +
" \"location\": \"eastus\",\n" +
" \"sku\": {\n" +
" \"name\": \"Standard_A1\",\n" +
" \"tier\": \"Standard\",\n" +
" \"capacity\": 10\n" +
" },\n" +
" \"properties\": {\n" +
" \"singlePlacementGroup\": true,\n" +
" \"overProvision\": true,\n" +
" \"upgradePolicy\": {\n" +
" \"mode\": \"Manual\"\n" +
" },\n" +
" \"virtualMachineProfile\": {\n" +
" \"storageProfile\": {\n" +
" \"imageReference\": {\n" +
" \"publisher\": \"Canonical\",\n" +
" \"offer\": \"UbuntuServer\",\n" +
" \"sku\": \"16.04-LTS\",\n" +
" \"version\": \"latest\"\n" +
" },\n" +
" \"osDisk\": {\n" +
" \"osType\": \"Windows\",\n" +
" \"createOption\": \"FromImage\",\n" +
" \"managedDisk\": {\n" +
" \"storageAccountType\": \"Standard_LRS\"\n" +
" }\n" +
" },\n" +
" \"dataDisks\": [{\n" +
" \"diskSizeGB\": \"10\",\n" +
" \"lun\": 1,\n" +
" \"createOption\": \"Unrecognized\",\n" +
" \"caching\": \"None\",\n" +
" \"managedDisk\": {\n" +
" \"storageAccountType\": \"Standard_LRS\"\n" +
" }\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"osProfile\": {\n" +
" \"computerNamePrefix\": \"jclouds-vmssname\",\n" +
" \"adminUsername\": \"admin\",\n" +
" \"adminPassword\": \"password\",\n" +
" \"linuxConfiguration\": {\n" +
" \"disablePasswordAuthentication\": false\n" +
" },\n" +
" \"secrets\": []\n" +
" },\n" +
" \"networkProfile\": {\n" +
" \"networkInterfaceConfigurations\": [{\n" +
" \"name\": \"nicconfig1\",\n" +
" \"properties\": {\n" +
" \"primary\": true,\n" +
" \"enableAcceleratedNetworking\": false,\n" +
" \"dnsSettings\": {\n" +
" \"dnsServers\": [\"8.8.8.8\"]\n" +
" },\n" +
" \"ipConfigurations\": [{\n" +
" \"name\": \"ipconfig1\",\n" +
" \"properties\": {\n" +
" \"publicIPAddressConfiguration\": {\n" +
" \"name\": \"pub1\",\n" +
" \"properties\": {\n" +
" \"idleTimeoutInMinutes\": 15\n" +
" }\n" +
" },\n" +
" \"subnet\": {\n" +
" \"name\": \"virtualNetworkName\",\n" +
" \"id\": \"/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/" +
"jcloud-eastus/providers/Microsoft.Network/virtualNetworks/" +
"jclouds-eastus-virtualNetworkName/subnets/jclouds-eastus-subnet\",\n" +
" \"properties\": {}\n" +
" },\n" +
" \"privateIPAddressVersion\": \"IPv4\",\n" +
" \"loadBalancerBackendAddressPools\": [],\n" +
" \"loadBalancerInboundNatPools\": []\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"extensionProfile\": {\n" +
" \"extensions\": [{\n" +
" \"name\": \"extensionName\",\n" +
" \"properties\": {\n" +
" \"publisher\": \"Microsoft.compute\",\n" +
" \"type\": \"CustomScriptExtension\",\n" +
" \"typeHandlerVersion\": \"1.1\",\n" +
" \"autoUpgradeMinorVersion\": false,\n" +
" \"settings\": {\n" +
" \"fileUris\": [\"https://mystorage1.blob.core.windows.net/winvmextekfacnt/" +
"SampleCmd_1.cmd\"],\n" +
" \"commandToExecute\": \"SampleCmd_1.cmd\"\n" +
" },\n" +
" \"protectedSettings\": {\n" +
" \"StorageAccountKey\": \"jclouds-accountkey\"\n" +
" }\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n"
);
}
private VirtualMachineScaleSet CreateOrUpdateVMSS(VirtualMachineScaleSetApi vmssAPI) {
return vmssAPI.createOrUpdate(
vmssname,
"eastus",
VirtualMachineScaleSetSKU.create(
"Standard_A1",
"Standard",
10),
null,
VirtualMachineScaleSetProperties.create(
true,
true,
VirtualMachineScaleSetUpgradePolicy.create("Manual"),
null,
VirtualMachineScaleSetVirtualMachineProfile.create(
StorageProfile.create(
ImageReference.create(
null,
"Canonical",
"UbuntuServer",
"16.04-LTS",
"latest"),
OSDisk.create(
"Windows",
null,
null,
null,
"FromImage",
null,
ManagedDiskParameters.create(
null,
"Standard_LRS"),
null),
Arrays.asList(DataDisk.create(
null,
"10",
1,
null,
null,
"FromImage",
"None",
ManagedDiskParameters.create(
null,
"Standard_LRS"),
null))),
VirtualMachineScaleSetOSProfile.create(
"jclouds-vmssname",
"admin",
"password",
VirtualMachineScaleSetOSProfile.LinuxConfiguration.create(
false,
null),
null,
new ArrayList<Secrets>()),
getNetworkProfile(),
getExtensionProfile()
)
));
}
private VirtualMachineScaleSetNetworkProfile getNetworkProfile() {
List<NetworkProfile.NetworkInterface> networkInterfacesList =
new ArrayList<NetworkProfile.NetworkInterface>();
NetworkInterfaceCard nic =
createNetworkInterfaceCard(
"jc-nic-" + 123,
"eastus");
networkInterfacesList.add(NetworkProfile.NetworkInterface.create(
nic.id(),
NetworkProfile.NetworkInterface.NetworkInterfaceProperties.create(true)));
List<NetworkInterfaceConfiguration> networkInterfaceConfigurations =
new ArrayList<NetworkInterfaceConfiguration>();
List<VirtualMachineScaleSetIpConfiguration> virtualMachineScaleSetIpConfigurations =
new ArrayList<VirtualMachineScaleSetIpConfiguration>();
VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration =
VirtualMachineScaleSetPublicIPAddressConfiguration.create(
"pub1",
VirtualMachineScaleSetPublicIPAddressProperties.create(15));
VirtualMachineScaleSetIpConfigurationProperties virtualMachineScaleSetIpConfigurationProperties =
VirtualMachineScaleSetIpConfigurationProperties.create(
publicIPAddressConfiguration,
createDefaultSubnet(
"virtualNetworkName"
),
"IPv4",
null,
null,
null);
VirtualMachineScaleSetIpConfiguration virtualMachineScaleSetIpConfiguration =
VirtualMachineScaleSetIpConfiguration.create(
"ipconfig1",
virtualMachineScaleSetIpConfigurationProperties);
virtualMachineScaleSetIpConfigurations.add(virtualMachineScaleSetIpConfiguration);
ArrayList<String> dnsList = new ArrayList<String>();
dnsList.add("8.8.8.8");
VirtualMachineScaleSetDNSSettings dnsSettings = VirtualMachineScaleSetDNSSettings.create(dnsList);
NetworkInterfaceConfigurationProperties networkInterfaceConfigurationProperties =
NetworkInterfaceConfigurationProperties.create(
true,
false,
null,
dnsSettings,
virtualMachineScaleSetIpConfigurations);
NetworkInterfaceConfiguration networkInterfaceConfiguration =
NetworkInterfaceConfiguration.create(
"nicconfig1",
networkInterfaceConfigurationProperties);
networkInterfaceConfigurations.add(networkInterfaceConfiguration);
return VirtualMachineScaleSetNetworkProfile.create(networkInterfaceConfigurations);
}
private NetworkInterfaceCard createNetworkInterfaceCard(
String networkInterfaceCardName, String locationName) {
//Create properties object
NetworkInterfaceCardProperties networkInterfaceCardProperties =
NetworkInterfaceCardProperties.create(
null,
null,
false,
null,
IdReference.create(
"/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/" +
"jcloud-eastus/providers/" +
"Microsoft.Network/virtualNetworks/" +
"jclouds-eastus-virtualNetworkName/subnets/" +
"jclouds-eastus-subnet")
);
Map<String, String> tags = ImmutableMap.of("jclouds", "livetest");
return NetworkInterfaceCard.create(
networkInterfaceCardName,
"",
null,
locationName,
networkInterfaceCardProperties, tags);
}
protected Subnet createDefaultSubnet(final String subnetName) {
Subnet.SubnetProperties properties = Subnet.SubnetProperties.create(
null,
null,
null);
return Subnet.create(
subnetName,
"/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/jcloud-eastus/providers/" +
"Microsoft.Network/virtualNetworks/jclouds-eastus-virtualNetworkName/subnets/" +
"jclouds-eastus-subnet",
null,
properties);
}
private ExtensionProfile getExtensionProfile() {
List<Extension> extensions = new ArrayList<Extension>();
List<String> uris = new ArrayList<String>();
uris.add("https://mystorage1.blob.core.windows.net/winvmextekfacnt/SampleCmd_1.cmd");
Map<String, String> protectedSettings = new HashMap<String, String>();
protectedSettings.put("StorageAccountKey", "jclouds-accountkey");
Extension extension = Extension.create(
"extensionName",
ExtensionProperties.create(
"Microsoft.compute",
"CustomScriptExtension",
"1.1",
false,
ExtensionProfileSettings.create(
uris,
"SampleCmd_1.cmd"),
protectedSettings));
extensions.add(extension);
return ExtensionProfile.create(extensions);
}
public void testList() throws InterruptedException {
server.enqueue(jsonResponse("/virtualmachinescalesetlist.json").setResponseCode(200));
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup);
assertEquals(vmssAPI.list().size(), 1);
assertSent(server,
"GET",
"/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" +
"Microsoft.Compute"
+ "/VirtualMachineScaleSets?api-version=2017-03-30");
}
public void testListWhen404() throws InterruptedException {
server.enqueue(
jsonResponse("/virtualmachinescalesetlistwhen404.json").setResponseCode(404));
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(
resourcegroup + "1");
List<VirtualMachineScaleSet> vmssList = vmssAPI.list();
assertSent(server,
"GET",
"/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/" +
"Microsoft.Compute"
+ "/VirtualMachineScaleSets?api-version=2017-03-30");
assertTrue(isEmpty(vmssList));
}
public void testDeleteWhen404() throws InterruptedException {
server.enqueue(jsonResponse("/virtualmachinescalesetlist.json").setResponseCode(404));
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup);
assertNull(vmssAPI.delete(vmssname));
assertSent(server,
"DELETE",
"/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" +
"Microsoft.Compute"
+ "/VirtualMachineScaleSets/" + vmssname + "?api-version=2017-03-30");
}
public void testDelete() throws InterruptedException {
server.enqueue(response202WithHeader());
final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup);
assertNotNull(vmssAPI.delete(vmssname));
assertSent(server,
"DELETE",
"/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" +
"Microsoft.Compute"
+ "/VirtualMachineScaleSets/jclouds-vmssname?api-version=2017-03-30");
}
}

View File

@ -75,6 +75,7 @@ public class BaseAzureComputeApiMockTest {
protected Properties setupProperties() {
Properties properties = new Properties();
properties.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString());
properties.put("oauth.endpoint", "https://login.microsoftonline.com/tenant-id/oauth2/token");
return properties;

View File

@ -36,7 +36,6 @@
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
"storageAccountType": "Standard_LRS"
},
"createOption":"Empty",
"caching": "ReadWrite"
}
]

View File

@ -0,0 +1,64 @@
{
"sku": {
"name": "Standard_A1",
"tier": "Standard",
"capacity": 4
},
"properties": {
"singlePlacementGroup": true,
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"osProfile": {
"computerNamePrefix": "vmmsprefix",
"adminUsername": "jclouds",
"linuxConfiguration": {
"disablePasswordAuthentication": false
},
"secrets": []
},
"storageProfile": {
"osDisk": {
"createOption": "FromImage",
"caching": "None",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
},
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "16.04-LTS",
"version": "latest"
}
},
"networkProfile": {"networkInterfaceConfigurations":[{"name":"nicconfig1","properties":{"primary":true,"enableAcceleratedNetworking":false,"dnsSettings":{"dnsServers":["8.8.8.8"]},"ipConfigurations":[{"name":"ipconfig1","properties":{"publicIPAddressConfiguration":{"name":"pub1","properties":{"idleTimeoutInMinutes":15}},"subnet":{"id":"/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/jcloud-eastus/providers/Microsoft.Network/virtualNetworks/jclouds-eastus-virtualNetworkName/subnets/jclouds-eastus-subnet"},"privateIPAddressVersion":"IPv4"}}]}}]},
"extensionProfile": {
"extensions": [
{
"properties": {
"publisher": "Microsoft.compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.1",
"autoUpgradeMinorVersion": false,
"settings": {"fileUris":["https://mystorage1.blob.core.windows.net/winvmextekfacnt/SampleCmd_1.cmd"],"commandToExecute":"SampleCmd_1.cmd"}
},
"name": "extensionName"
}
]
}
},
"provisioningState": "Creating",
"overprovision": true,
"uniqueId": "xxxxx-xxxx-xxxx-xxxx-xxxxxx"
},
"type": "Microsoft.Compute/virtualMachineScaleSets",
"location": "eastus",
"tags": {
"test": "test"
},
"id": "/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/jcloud-eastus/providers/Microsoft.Compute/virtualMachineScaleSets/jclouds-vmssname",
"name": "jclouds-vmssname"
}

View File

@ -0,0 +1,6 @@
{
"error": {
"code": "ResourceNotFound",
"message": "The Resource 'Microsoft.Compute/virtualMachineScaleSets/jclouds-vmssname1' under resource group 'jcloud-eastus' was not found."
}
}

View File

@ -0,0 +1,93 @@
{
"value": [{
"sku": {
"name": "Standard_A1",
"tier": "Standard",
"capacity": 4
},
"properties": {
"singlePlacementGroup": true,
"upgradePolicy": {
"mode": "Manual",
"automaticOSUpgrade": false
},
"virtualMachineProfile": {
"osProfile": {
"computerNamePrefix": "vmmsprefix",
"adminUsername": "jclouds",
"linuxConfiguration": {
"disablePasswordAuthentication": false
},
"secrets": []
},
"storageProfile": {
"osDisk": {
"createOption": "FromImage",
"caching": "None",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
},
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "16.04-LTS",
"version": "latest"
}
},
"networkProfile": {
"networkInterfaceConfigurations": [{
"name": "nicconfig1",
"properties": {
"primary": true,
"enableAcceleratedNetworking": false,
"dnsSettings": {
"dnsServers": ["8.8.8.8"]
},
"ipConfigurations": [{
"name": "ipconfig1",
"properties": {
"publicIPAddressConfiguration": {
"name": "pub1",
"properties": {
"idleTimeoutInMinutes": 15
}
},
"subnet": {
"id": "/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/jcloud-eastus/providers/Microsoft.Network/virtualNetworks/jclouds-eastus-virtualNetworkName/subnets/jclouds-eastus-subnet"
},
"privateIPAddressVersion": "IPv4"
}
}]
}
}]
},
"extensionProfile": {
"extensions": [{
"properties": {
"publisher": "Microsoft.compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.1",
"autoUpgradeMinorVersion": false,
"settings": {
"fileUris": ["https://mystorage1.blob.core.windows.net/winvmextekfacnt/SampleCmd_1.cmd"],
"commandToExecute": "SampleCmd_1.cmd"
}
},
"name": "extensionName"
}]
}
},
"provisioningState": "Failed",
"overprovision": true,
"uniqueId": "xxxxx-xxxx-xxxx-xxxx-xxxxxx"
},
"type": "Microsoft.Compute/virtualMachineScaleSets",
"location": "eastus",
"tags": {
"test": "test"
},
"id": "/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/jcloud-eastus/providers/Microsoft.Compute/virtualMachineScaleSets/jclouds-vmssname",
"name": "jclouds-vmssname"
}]
}

View File

@ -0,0 +1,6 @@
{
"error": {
"code": "ResourceGroupNotFound",
"message": "Resource group 'jcloud-eastus1' could not be found."
}
}

View File

@ -0,0 +1,103 @@
{
"location": "eastus",
"sku": {
"name": "Standard_A1",
"tier": "Standard",
"capacity": 10
},
"properties": {
"singlePlacementGroup": true,
"overProvision": true,
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "16.04-LTS",
"version": "latest"
},
"osDisk": {
"osType": "Windows",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
},
"dataDisks": [{
"diskSizeGB": "10",
"lun": 1,
"createOption": "Unrecognized",
"caching": "None",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
}
]
},
"osProfile": {
"computerNamePrefix": "jclouds-vmssname",
"adminUsername": "jclouds",
"adminPassword": "jClouds1!",
"linuxConfiguration": {
"disablePasswordAuthentication": "False"
},
"secrets": []
},
"networkProfile": {
"networkInterfaceConfigurations": [{
"name": "nicconfig1",
"properties": {
"primary": true,
"enableAcceleratedNetworking": false,
"dnsSettings": {
"dnsServers": ["8.8.8.8"]
},
"ipConfigurations": [{
"name": "ipconfig1",
"properties": {
"publicIPAddressConfiguration": {
"name": "pub1",
"properties": {
"idleTimeoutInMinutes": 15
}
},
"subnet": {
"name": "virtualNetworkName",
"id": "/subscriptions/xxxxx-xxxx-xxxx-xxxx-xxxxxx/resourceGroups/jcloud-eastus/providers/Microsoft.Network/virtualNetworks/jclouds-eastus-virtualNetworkName/subnets/jclouds-eastus-subnet",
"properties": {}
},
"privateIPAddressVersion": "IPv4",
"loadBalancerBackendAddressPools": [],
"loadBalancerInboundNatPools": []
}
}
]
}
}
]
},
"extensionProfile": {
"extensions": [{
"name": "extensionName",
"properties": {
"publisher": "Microsoft.compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.1",
"autoUpgradeMinorVersion": false,
"settings": {
"fileUris": ["https://mystorage1.blob.core.windows.net/winvmextekfacnt/SampleCmd_1.cmd"],
"commandToExecute": "SampleCmd_1.cmd"
},
"protectedSettings": {
"StorageAccountKey": "jclouds-accountkey"
}
}
}
]
}
}
}
}