JCLOUDS-664 Azurecompute-arm NicApi PublicIPApi and VMApi
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/3be36289 Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/3be36289 Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/3be36289 Branch: refs/heads/master Commit: 3be36289f594c42af2f46daee1661556fb0e3a35 Parents: 1f21537 Author: Rita Zhang <[email protected]> Authored: Wed Apr 27 16:36:14 2016 -0700 Committer: Ignasi Barrera <[email protected]> Committed: Wed May 11 16:05:13 2016 -0700 ---------------------------------------------------------------------- .../azurecompute/arm/AzureComputeApi.java | 35 ++- .../arm/domain/AvailabilitySet.java | 104 ++++++++ .../domain/AvailabilitySetVirtualMachine.java | 37 +++ .../azurecompute/arm/domain/DataDisk.java | 80 ++++++ .../arm/domain/DiagnosticsProfile.java | 68 +++++ .../azurecompute/arm/domain/DnsSettings.java | 57 +++++ .../arm/domain/HardwareProfile.java | 45 ++++ .../azurecompute/arm/domain/IdReference.java | 34 +++ .../azurecompute/arm/domain/ImageReference.java | 80 ++++++ .../arm/domain/IpConfiguration.java | 66 +++++ .../arm/domain/IpConfigurationProperties.java | 72 ++++++ .../arm/domain/NetworkInterfaceCard.java | 56 +++++ .../domain/NetworkInterfaceCardProperties.java | 78 ++++++ .../azurecompute/arm/domain/NetworkProfile.java | 55 ++++ .../jclouds/azurecompute/arm/domain/OSDisk.java | 85 +++++++ .../azurecompute/arm/domain/OSProfile.java | 236 ++++++++++++++++++ .../arm/domain/PublicIPAddress.java | 52 ++++ .../arm/domain/PublicIPAddressProperties.java | 83 +++++++ .../azurecompute/arm/domain/StorageProfile.java | 78 ++++++ .../jclouds/azurecompute/arm/domain/Subnet.java | 10 +- .../jclouds/azurecompute/arm/domain/VHD.java | 45 ++++ .../azurecompute/arm/domain/VirtualMachine.java | 69 +++++ .../arm/domain/VirtualMachineInstance.java | 72 ++++++ .../arm/domain/VirtualMachineProperties.java | 133 ++++++++++ .../azurecompute/arm/domain/VirtualNetwork.java | 12 +- .../arm/features/NetworkInterfaceCardApi.java | 78 ++++++ .../arm/features/PublicIPAddressApi.java | 78 ++++++ .../arm/features/VirtualMachineApi.java | 135 ++++++++++ .../NetworkInterfaceCardApiLiveTest.java | 139 +++++++++++ .../NetworkInterfaceCardApiMockTest.java | 150 +++++++++++ .../features/PublicIPAddressApiLiveTest.java | 129 ++++++++++ .../features/PublicIPAddressApiMockTest.java | 179 +++++++++++++ .../arm/features/VirtualMachineApiLiveTest.java | 245 ++++++++++++++++++ .../arm/features/VirtualMachineApiMockTest.java | 249 +++++++++++++++++++ .../AbstractAzureComputeApiLiveTest.java | 2 +- .../internal/BaseAzureComputeApiLiveTest.java | 48 +++- .../test/resources/PublicIPAddressCreate.json | 20 ++ .../PublicIPAddressCreateDnsRecordInUse.json | 7 + .../test/resources/PublicIPAddressGetInfo.json | 24 ++ .../src/test/resources/PublicIPAddressList.json | 80 ++++++ .../resources/createnetworkinterfacecard.json | 35 +++ .../resources/createvirtualmachineresponse.json | 47 ++++ .../test/resources/getnetworkinterfacecard.json | 35 +++ .../test/resources/listnetworkinterfaces.json | 68 +++++ .../src/test/resources/resourcegroups.json | 1 - .../src/test/resources/virtualmachine.json | 47 ++++ .../test/resources/virtualmachineInstance.json | 40 +++ .../src/test/resources/virtualmachines.json | 57 +++++ 48 files changed, 3625 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java index 5b4d600..f8ac6e9 100644 --- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java @@ -16,21 +16,23 @@ */ package org.jclouds.azurecompute.arm; -import java.io.Closeable; - import org.jclouds.azurecompute.arm.features.JobApi; import org.jclouds.azurecompute.arm.features.LocationApi; +import org.jclouds.azurecompute.arm.features.NetworkInterfaceCardApi; +import org.jclouds.azurecompute.arm.features.PublicIPAddressApi; import org.jclouds.azurecompute.arm.features.ResourceGroupApi; import org.jclouds.azurecompute.arm.features.StorageAccountApi; import org.jclouds.azurecompute.arm.features.SubnetApi; +import org.jclouds.azurecompute.arm.features.VirtualMachineApi; import org.jclouds.azurecompute.arm.features.VirtualNetworkApi; import org.jclouds.rest.annotations.Delegate; import javax.ws.rs.PathParam; +import java.io.Closeable; /** * The Azure Resource Manager API is a REST API for managing your services and deployments. - * <p/> + * <p> * * @see <a href="https://msdn.microsoft.com/en-us/library/azure/dn790568.aspx" >doc</a> */ @@ -62,6 +64,7 @@ public interface AzureComputeApi extends Closeable { */ @Delegate StorageAccountApi getStorageAccountApi(@PathParam("resourceGroup") String resourceGroup); + /** * The Subnet API includes operations for managing the subnets in your virtual network. * @@ -79,4 +82,30 @@ public interface AzureComputeApi extends Closeable { @Delegate VirtualNetworkApi getVirtualNetworkApi(@PathParam("resourcegroup") String resourcegroup); + + /** + * The Network Interface Card API includes operations for managing the NICs in your subscription. + * + * @see <a href="https://msdn.microsoft.com/en-us/library/mt163668.aspx">docs</a> + */ + @Delegate + NetworkInterfaceCardApi getNetworkInterfaceCardApi(@PathParam("resourcegroup") String resourcegroup); + + /** + * The Public IP Address API includes operations for managing public ID Addresses for NICs in your subscription. + * + * @see <a href="https://msdn.microsoft.com/en-us/library/azure/mt163638.aspx">docs</a> + */ + @Delegate + PublicIPAddressApi getPublicIPAddressApi(@PathParam("resourcegroup") String resourcegroup); + + + /** + * The Virtual Machine 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 + VirtualMachineApi getVirtualMachineApi(@PathParam("resourceGroup") String resourceGroup); + } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySet.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySet.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySet.java new file mode 100644 index 0000000..cb90307 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySet.java @@ -0,0 +1,104 @@ +/* + * 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 com.google.common.collect.ImmutableMap; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; +import java.util.Map; +import java.util.List; + +/** + * AvailabilitySet for subscription + */ +@AutoValue +public abstract class AvailabilitySet { + + @AutoValue + public abstract static class AvailabilitySetProperties { + + /** + * A platform Update Domain Count + */ + public abstract int platformUpdateDomainCount(); + + /** + * A platform Fault Domain Count + */ + public abstract int platformFaultDomainCount(); + + /** + * A list of virtual machines in availability set + */ + @Nullable + public abstract List<AvailabilitySetVirtualMachine> virtualMachines(); + + @SerializedNames({"platformUpdateDomainCount", "platformFaultDomainCount", "virtualMachines"}) + public static AvailabilitySetProperties create(final int platformUpdateDomainCount, + final int platformFaultDomainCount, + List<AvailabilitySetVirtualMachine> virtualMachines) { + return new AutoValue_AvailabilitySet_AvailabilitySetProperties(platformUpdateDomainCount, + platformFaultDomainCount, + virtualMachines == null ? null : ImmutableList.copyOf(virtualMachines)); + } + } + + /** + * The id of the availability set + */ + public abstract String id(); + + /** + * The name of the availability set. + */ + @Nullable + public abstract String name(); + + /** + * The name of the availability set. + */ + @Nullable + public abstract String type(); + + /** + * The location of the availability set + */ + @Nullable + public abstract String location(); + + /** + * Specifies the tags of the availability set + */ + @Nullable + public abstract Map<String, String> tags(); + + /** + * Specifies the properties of the availability set + */ + @Nullable + public abstract AvailabilitySetProperties properties(); + + + @SerializedNames({"id", "name", "type", "location", "tags", "properties"}) + public static AvailabilitySet create(final String id, final String name, final String type, final String location, + final Map<String, String> tags, AvailabilitySetProperties properties) { + return new AutoValue_AvailabilitySet(id, name, type, location, tags == null ? null : ImmutableMap.copyOf(tags), properties); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySetVirtualMachine.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySetVirtualMachine.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySetVirtualMachine.java new file mode 100644 index 0000000..3837ff2 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/AvailabilitySetVirtualMachine.java @@ -0,0 +1,37 @@ +/* + * 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; + +/** + * The virtual machine id + */ +@AutoValue +public abstract class AvailabilitySetVirtualMachine { + + /** + * The id of the virtual machine. + */ + public abstract String id(); + + @SerializedNames({"id"}) + public static AvailabilitySetVirtualMachine create(final String id) { + return new AutoValue_AvailabilitySetVirtualMachine(id); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DataDisk.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DataDisk.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DataDisk.java new file mode 100644 index 0000000..de1fa36 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DataDisk.java @@ -0,0 +1,80 @@ +/* + * 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 DataDisk { + + /** + * The name of the data disk + */ + public abstract String name(); + + /** + * The size of the data disk + */ + public abstract String diskSizeGB(); + + /** + * The lun value of the data disk + */ + public abstract int lun(); + + /** + * The vhd of the data disk + */ + public abstract VHD vhd(); + + /** + * The create option of the data disk + */ + public abstract String createOption(); + + @SerializedNames({"name", "diskSizeGB", "lun", "vhd", "createOption"}) + public static DataDisk create(final String name, final String diskSizeGB, final int lun, + final VHD vhd, final String createOption) { + return builder() + .name(name) + .diskSizeGB(diskSizeGB) + .lun(lun) + .createOption(createOption) + .vhd(vhd) + .build(); + } + + public static Builder builder() { + return new AutoValue_DataDisk.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder name(String name); + + public abstract Builder diskSizeGB(String diskSizeGB); + + public abstract Builder createOption(String createOption); + + public abstract Builder lun(int lun); + + public abstract Builder vhd(VHD vhd); + + public abstract DataDisk build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DiagnosticsProfile.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DiagnosticsProfile.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DiagnosticsProfile.java new file mode 100644 index 0000000..6097e59 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DiagnosticsProfile.java @@ -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; + +@AutoValue +public abstract class DiagnosticsProfile { + + @AutoValue + public abstract static class BootDiagnostics{ + + public abstract boolean enabled(); + + @Nullable + public abstract String storageUri(); + + @SerializedNames({"enabled", "storageUri"}) + public static BootDiagnostics create(final boolean enabled, final String storageUri) { + return builder() + .enabled(enabled) + .storageUri(storageUri) + .build(); + } + + public static Builder builder() { + return new AutoValue_DiagnosticsProfile_BootDiagnostics.Builder(); + } + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder enabled(boolean enabled); + public abstract Builder storageUri(String storageUri); + public abstract BootDiagnostics build(); + } + } + + public abstract BootDiagnostics bootDiagnostics(); + + @SerializedNames({"bootDiagnostics"}) + public static DiagnosticsProfile create(final BootDiagnostics bootDiagnostics) { + return builder().bootDiagnostics(bootDiagnostics).build(); + } + public static Builder builder() { + return new AutoValue_DiagnosticsProfile.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder bootDiagnostics(BootDiagnostics bootDiagnostics); + public abstract DiagnosticsProfile build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DnsSettings.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DnsSettings.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DnsSettings.java new file mode 100644 index 0000000..a527eb0 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/DnsSettings.java @@ -0,0 +1,57 @@ +/* + * 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 DnsSettings { + + public abstract String domainNameLabel(); + + @Nullable + public abstract String fqdn(); + + @Nullable + public abstract String reverseFqdn(); + + @SerializedNames({"domainNameLabel", "fqdn", "reverseFqdn"}) + public static DnsSettings create(final String domainNameLabel, final String fqdn, final String reverseFqdn) { + return builder() + .domainNameLabel(domainNameLabel) + .fqdn(fqdn) + .reverseFqdn(reverseFqdn) + .build(); + } + + public static Builder builder() { + return new AutoValue_DnsSettings.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder domainNameLabel(String domainNameLabel); + + public abstract Builder fqdn(String fqdn); + + public abstract Builder reverseFqdn(String reverseFqdn); + + public abstract DnsSettings build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/HardwareProfile.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/HardwareProfile.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/HardwareProfile.java new file mode 100644 index 0000000..ee9a5f1 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/HardwareProfile.java @@ -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 HardwareProfile { + + /** + * The vm size of the virtual machine. + */ + public abstract String vmSize(); + + @SerializedNames({"vmSize"}) + public static HardwareProfile create(final String vmSize) { + return builder().vmSize(vmSize).build(); + } + + public static Builder builder() { + return new AutoValue_HardwareProfile.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder vmSize(String vmSize); + + public abstract HardwareProfile build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IdReference.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IdReference.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IdReference.java new file mode 100644 index 0000000..1854897 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IdReference.java @@ -0,0 +1,34 @@ +/* + * 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; + +// Simple helper class to serialize / deserialize id reference. + +@AutoValue +public abstract class IdReference { + @Nullable + public abstract String id(); + + @SerializedNames({"id"}) + public static IdReference create(final String id) { + return new AutoValue_IdReference(id); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/ImageReference.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/ImageReference.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/ImageReference.java new file mode 100644 index 0000000..9cc6747 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/ImageReference.java @@ -0,0 +1,80 @@ +/* + * 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 ImageReference { + + /** + * The publisher of the image reference. + */ + @Nullable + public abstract String publisher(); + + /** + * The offer of the image reference. + */ + @Nullable + public abstract String offer(); + + /** + * The sku of the image reference. + */ + @Nullable + public abstract String sku(); + + /** + * The version of the image reference. + */ + @Nullable + public abstract String version(); + + @SerializedNames({"publisher", "offer", "sku", "version"}) + public static ImageReference create(final String publisher, + final String offer, + final String sku, + final String version) { + + return builder() + .publisher(publisher) + .offer(offer) + .sku(sku) + .version(version) + .build(); + } + + public static Builder builder() { + return new AutoValue_ImageReference.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder publisher(String publisher); + + public abstract Builder offer(String offer); + + public abstract Builder sku(String sku); + + public abstract Builder version(String version); + + public abstract ImageReference build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfiguration.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfiguration.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfiguration.java new file mode 100644 index 0000000..bb49a77 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfiguration.java @@ -0,0 +1,66 @@ +/* + * 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 IpConfiguration { + + @Nullable + public abstract String name(); + + @Nullable + public abstract String id(); + + @Nullable + public abstract String etag(); + + @Nullable + public abstract Boolean primary(); + + @Nullable + public abstract IpConfigurationProperties properties(); + + @SerializedNames({"name", "id", "etag", "primary", "properties"}) + public static IpConfiguration create(final String name, final String id, final String etag, final Boolean primary, final IpConfigurationProperties properties) { + return builder() + .name(name) + .id(id) + .etag(etag) + .primary(primary) + .properties(properties) + .build(); + } + + public static Builder builder() { + return new AutoValue_IpConfiguration.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder name(String name); + public abstract Builder id(String id); + public abstract Builder etag(String etag); + public abstract Builder primary(Boolean primary); + public abstract Builder properties(IpConfigurationProperties properties); + public abstract IpConfiguration build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfigurationProperties.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfigurationProperties.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfigurationProperties.java new file mode 100644 index 0000000..8e3bd53 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/IpConfigurationProperties.java @@ -0,0 +1,72 @@ +/* + * 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 IpConfigurationProperties { + + @Nullable + public abstract String provisioningState(); + + @Nullable + public abstract String privateIPAddress(); + + @Nullable + public abstract String privateIPAllocationMethod(); + + @Nullable + public abstract IdReference subnet(); + + @Nullable + public abstract IdReference publicIPAddress(); + + @SerializedNames({"provisioningState", "privateIPAddress", "privateIPAllocationMethod", "subnet", "publicIPAddress"}) + public static IpConfigurationProperties create(final String provisioningState, final String privateIPAddress, final String privateIPAllocationMethod, final IdReference subnet, final IdReference publicIPAddress) { + + return builder() + .provisioningState(provisioningState) + .privateIPAddress(privateIPAddress) + .privateIPAllocationMethod(privateIPAllocationMethod) + .subnet(subnet) + .publicIPAddress(publicIPAddress) + .build(); + } + + public static Builder builder() { + return new AutoValue_IpConfigurationProperties.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder provisioningState(String provisioningState); + + public abstract Builder privateIPAddress(String privateIPAddress); + + public abstract Builder privateIPAllocationMethod(String privateIPAllocationMethod); + + public abstract Builder subnet(IdReference subnet); + + public abstract Builder publicIPAddress(IdReference publicIPAddress); + + public abstract IpConfigurationProperties build(); + } +} + http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCard.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCard.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCard.java new file mode 100644 index 0000000..567addc --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCard.java @@ -0,0 +1,56 @@ +/* + * 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; + +@AutoValue +public abstract class NetworkInterfaceCard { + + @Nullable + public abstract String name(); + + @Nullable + public abstract String id(); + + @Nullable + public abstract String etag(); + + @Nullable + public abstract String location(); + + @Nullable + public abstract NetworkInterfaceCardProperties properties(); + + @Nullable + public abstract Map<String, String> tags(); + + @SerializedNames({"name", "id", "etag", "location", "properties", "tags"}) + public static NetworkInterfaceCard create(final String name, + final String id, + final String etag, + 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)); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCardProperties.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCardProperties.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCardProperties.java new file mode 100644 index 0000000..e6f2de7 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkInterfaceCardProperties.java @@ -0,0 +1,78 @@ +/* + * 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 NetworkInterfaceCardProperties { + + @Nullable + public abstract String provisioningState(); + + @Nullable + public abstract String resourceGuid(); + + @Nullable + public abstract Boolean enableIPForwarding(); + + @Nullable + public abstract List<IpConfiguration> ipConfigurations(); + + @SerializedNames({"provisioningState", "resourceGuid", "enableIPForwarding", "ipConfigurations"}) + public static NetworkInterfaceCardProperties create(final String provisioningState, final String resourceGuid, final Boolean enableIPForwarding, final List<IpConfiguration> ipConfigurations) { + NetworkInterfaceCardProperties.Builder builder = NetworkInterfaceCardProperties.builder() + .provisioningState(provisioningState) + .resourceGuid(resourceGuid) + .enableIPForwarding(enableIPForwarding) + .ipConfigurations(ipConfigurations == null ? null : ImmutableList.copyOf(ipConfigurations)); + + return builder.build(); + } + + public static Builder builder() { + + return new AutoValue_NetworkInterfaceCardProperties.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder provisioningState(String provisioningState); + + public abstract Builder resourceGuid(String resourceGuid); + + public abstract Builder enableIPForwarding(Boolean enableIPForwarding); + + public abstract Builder ipConfigurations(List<IpConfiguration> ipConfigurations); + + abstract List<IpConfiguration> ipConfigurations(); + + abstract NetworkInterfaceCardProperties autoBuild(); + + public NetworkInterfaceCardProperties build() { + ipConfigurations(ipConfigurations() != null ? ImmutableList.copyOf(ipConfigurations()) : null); + return autoBuild(); + } + } +} + + http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkProfile.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkProfile.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkProfile.java new file mode 100644 index 0000000..ffcf9ee --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkProfile.java @@ -0,0 +1,55 @@ +/* + * 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 NetworkProfile { + + /** + * List of network interfaces + */ + public abstract List<IdReference> networkInterfaces(); + + @SerializedNames({"networkInterfaces"}) + public static NetworkProfile create(final List<IdReference> networkInterfaces) { + return builder().networkInterfaces(networkInterfaces).build(); + } + + public static Builder builder() { + return new AutoValue_NetworkProfile.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder networkInterfaces(List<IdReference> networkInterfaces); + + abstract List<IdReference> networkInterfaces(); + + abstract NetworkProfile autoBuild(); + + public NetworkProfile build() { + networkInterfaces(networkInterfaces() != null ? ImmutableList.copyOf(networkInterfaces()) : ImmutableList.<IdReference>of()); + return autoBuild(); + } + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSDisk.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSDisk.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSDisk.java new file mode 100644 index 0000000..a9f7349 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSDisk.java @@ -0,0 +1,85 @@ +/* + * 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 OSDisk { + /** + * The OS type of the os disk + */ + @Nullable + public abstract String osType(); + + /** + * The name of the os disk + */ + @Nullable + public abstract String name(); + + /** + * The vhd of the os disk + */ + @Nullable + public abstract VHD vhd(); + + /** + * The caching mode of the os disk + */ + @Nullable + public abstract String caching(); + + /** + * The create options of the os disk + */ + @Nullable + public abstract String createOption(); + + @SerializedNames({"osType", "name", "vhd", "caching", "createOption"}) + public static OSDisk create(final String osType, final String name, final VHD vhd, + final String caching, final String createOption) { + return builder() + .osType(osType) + .name(name) + .vhd(vhd) + .caching(caching) + .createOption(createOption) + .build(); + } + + public static Builder builder() { + return new AutoValue_OSDisk.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder osType(String osType); + + public abstract Builder name(String name); + + public abstract Builder caching(String caching); + + public abstract Builder createOption(String createOption); + + public abstract Builder vhd(VHD vhd); + + public abstract OSDisk build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSProfile.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSProfile.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSProfile.java new file mode 100644 index 0000000..9240824 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSProfile.java @@ -0,0 +1,236 @@ +/* + * 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; +import java.util.Map; +import com.google.common.collect.ImmutableMap; + +@AutoValue +public abstract class OSProfile { + + @AutoValue + public abstract static class LinuxConfiguration { + + @AutoValue + public abstract static class SSH { + + @AutoValue + public abstract static class SSHPublicKey { + + @Nullable + public abstract String path(); + + @Nullable + public abstract String keyData(); + + @SerializedNames({"path", "keyData"}) + public static SSHPublicKey create(final String path, final String keyData) { + + return new AutoValue_OSProfile_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_OSProfile_LinuxConfiguration_SSH( + publicKeys); + } + } + + /** + * The authentication method password or ssh + */ + public abstract String disablePasswordAuthentication(); + + /** + * ssh keys + */ + @Nullable + public abstract SSH ssh(); + + @SerializedNames({"disablePasswordAuthentication", "ssh"}) + public static LinuxConfiguration create(final String disablePasswordAuthentication, + final SSH ssh) { + + return new AutoValue_OSProfile_LinuxConfiguration(disablePasswordAuthentication, + ssh); + } + } + + @AutoValue + public abstract static class WindowsConfiguration { + + @AutoValue + public abstract static class WinRM { + + /** + * Map of different settings + */ + public abstract Map<String, String> listeners(); + + @SerializedNames({"listeners"}) + public static WinRM create(final Map<String, String> listeners) { + return new AutoValue_OSProfile_WindowsConfiguration_WinRM(listeners == null ? ImmutableMap.<String, String>of() : ImmutableMap.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_OSProfile_WindowsConfiguration_AdditionalUnattendContent( + pass, component, settingName, content); + } + } + + /** + * The provision VM Agent true of false. + */ + public abstract boolean provisionVMAgent(); + + /** + * winR + */ + @Nullable + public abstract WinRM winRM(); + + /** + * unattend content + */ + @Nullable + public abstract AdditionalUnattendContent additionalUnattendContent(); + + /** + * is automatic updates enabled + */ + public abstract boolean enableAutomaticUpdates(); + + /** + * list of certificates + */ + @Nullable + public abstract List<String> secrets(); + + @SerializedNames({"provisionVMAgent", "winRM", "additionalUnattendContent", "enableAutomaticUpdates", + "secrets"}) + public static WindowsConfiguration create(final boolean provisionVMAgent, final WinRM winRM, + final AdditionalUnattendContent additionalUnattendContent, + final boolean enableAutomaticUpdates, final List<String> secrets) { + + return new AutoValue_OSProfile_WindowsConfiguration(provisionVMAgent, winRM, + additionalUnattendContent, enableAutomaticUpdates, secrets == null ? null : ImmutableList.copyOf(secrets)); + } + } + + /** + * The computer name of the VM + */ + @Nullable + public abstract String computerName(); + + /** + * The admin username of the VM + */ + @Nullable + public abstract String adminUsername(); + + /** + * The admin password of the VM + */ + @Nullable + public abstract String adminPassword(); + + /** + * The custom data of the VM + */ + @Nullable + public abstract String customData(); + + /** + * The linux configuration of the VM + */ + @Nullable + public abstract LinuxConfiguration linuxConfiguration(); + + /** + * The windows configuration of the VM + */ + @Nullable + public abstract WindowsConfiguration windowsConfiguration(); + + @SerializedNames({"computerName", "adminUsername", "adminPassword", "customData", "linuxConfiguration", + "windowsConfiguration"}) + public static OSProfile create(final String computerName, final String adminUsername, final String adminPassword, + final String customData, final LinuxConfiguration linuxConfiguration, + final WindowsConfiguration windowsConfiguration) { + return builder() + .computerName(computerName) + .adminUsername(adminUsername) + .adminPassword(adminPassword) + .customData(customData) + .linuxConfiguration(linuxConfiguration) + .windowsConfiguration(windowsConfiguration) + .build(); + } + + public static Builder builder() { + return new AutoValue_OSProfile.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder computerName(String computerName); + + public abstract Builder adminUsername(String adminUsername); + + public abstract Builder adminPassword(String adminPassword); + + public abstract Builder customData(String customData); + + public abstract Builder linuxConfiguration(LinuxConfiguration linuxConfiguration); + + public abstract Builder windowsConfiguration(WindowsConfiguration windowsConfiguration); + + public abstract OSProfile build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddress.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddress.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddress.java new file mode 100644 index 0000000..a08fadd --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddress.java @@ -0,0 +1,52 @@ +/* + * 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; + +@AutoValue +public abstract class PublicIPAddress { + + public abstract String name(); + + public abstract String id(); + + public abstract String etag(); + + public abstract String location(); + + @Nullable + public abstract Map<String, String> tags(); + + public abstract PublicIPAddressProperties properties(); + + @SerializedNames({"name", "id", "etag", "location", "tags", "properties"}) + public static PublicIPAddress create(final String name, + final String id, + final String etag, + final String location, + final Map<String, String> tags, + final PublicIPAddressProperties properties) { + return new AutoValue_PublicIPAddress(name, id, etag, location, tags == null ? null : ImmutableMap.copyOf(tags), properties); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddressProperties.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddressProperties.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddressProperties.java new file mode 100644 index 0000000..2fc7fb5 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/PublicIPAddressProperties.java @@ -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.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class PublicIPAddressProperties { + + @Nullable // needs to be nullable to create the payload for create request + public abstract String provisioningState(); + + @Nullable // only set in succeeded provisioningState for Static IP and for Dynamic when attached to a NIC + public abstract String ipAddress(); + + public abstract String publicIPAllocationMethod(); + + @Nullable + public abstract Integer idleTimeoutInMinutes(); + + @Nullable // only if attached to NIC + public abstract IdReference ipConfiguration(); + + @Nullable // only if DNS name is set + public abstract DnsSettings dnsSettings(); + + @SerializedNames({"provisioningState", "ipAddress", "publicIPAllocationMethod", "idleTimeoutInMinutes", "ipConfiguration", "dnsSettings"}) + public static PublicIPAddressProperties create(final String provisioningState, + final String ipAddress, + final String publicIPAllocationMethod, + final Integer idleTimeoutInMinutes, + final IdReference ipConfiguration, + final DnsSettings dnsSettings) { + return builder() + .provisioningState(provisioningState) + .ipAddress(ipAddress) + .publicIPAllocationMethod(publicIPAllocationMethod) + .idleTimeoutInMinutes(idleTimeoutInMinutes) + .ipConfiguration(ipConfiguration) + .dnsSettings(dnsSettings) + .publicIPAllocationMethod(publicIPAllocationMethod) + .dnsSettings(dnsSettings) + .build(); + } + + public static Builder builder() { + return new AutoValue_PublicIPAddressProperties.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder provisioningState(String provisioningState); + + public abstract Builder ipAddress(String ipAddress); + + public abstract Builder publicIPAllocationMethod(String publicIPAllocationMethod); + + public abstract Builder idleTimeoutInMinutes(Integer idleTimeoutInMinutes); + + public abstract Builder ipConfiguration(IdReference ipConfiguration); + + public abstract Builder dnsSettings(DnsSettings dnsSettings); + + public abstract PublicIPAddressProperties build(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/StorageProfile.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/StorageProfile.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/StorageProfile.java new file mode 100644 index 0000000..7c693ef --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/StorageProfile.java @@ -0,0 +1,78 @@ +/* + * 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 StorageProfile { + + /** + * The image reference of the storage profile + */ + public abstract ImageReference imageReference(); + + /** + * The image reference of the storage profile + */ + public abstract OSDisk osDisk(); + + /** + * The list of the data disks of the storage profile + */ + @Nullable + public abstract List<DataDisk> dataDisks(); + + @SerializedNames({"imageReference", "osDisk", "dataDisks"}) + public static StorageProfile create(final ImageReference imageReference, + final OSDisk osDisk, final List<DataDisk> dataDisks) { + StorageProfile.Builder builder = StorageProfile.builder() + .imageReference(imageReference) + .osDisk(osDisk) + .dataDisks(dataDisks != null ? ImmutableList.copyOf(dataDisks) : null); + + return builder.build(); + } + + public static Builder builder() { + return new AutoValue_StorageProfile.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder imageReference(ImageReference imageReference); + + public abstract Builder osDisk(OSDisk osDisk); + + public abstract Builder dataDisks(List<DataDisk> dataDisks); + + abstract List<DataDisk> dataDisks(); + + abstract StorageProfile autoBuild(); + + public StorageProfile build() { + dataDisks(dataDisks() != null ? ImmutableList.copyOf(dataDisks()) : null); + return autoBuild(); + } + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java index b195b7d..e4024df 100644 --- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Subnet.java @@ -20,6 +20,7 @@ import static com.google.common.collect.ImmutableList.copyOf; import java.util.List; +import com.google.common.collect.ImmutableList; import org.jclouds.javax.annotation.Nullable; import com.google.auto.value.AutoValue; import org.jclouds.json.SerializedNames; @@ -71,7 +72,14 @@ public abstract class Subnet { public abstract Builder ipConfigurations(List<IpConfiguration> ipConfigurations); - public abstract SubnetProperties build(); + abstract List<IpConfiguration> ipConfigurations(); + + abstract SubnetProperties autoBuild(); + + public SubnetProperties build() { + ipConfigurations(ipConfigurations() != null ? ImmutableList.copyOf(ipConfigurations()) : null); + return autoBuild(); + } } } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VHD.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VHD.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VHD.java new file mode 100644 index 0000000..3b1421a --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VHD.java @@ -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 VHD { + + /** + * The uri of the vhd. + */ + public abstract String uri(); + + @SerializedNames({"uri"}) + public static VHD create(final String uri) { + return builder().uri(uri).build(); + } + + public static Builder builder() { + return new AutoValue_VHD.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder uri(String uri); + + public abstract VHD build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachine.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachine.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachine.java new file mode 100644 index 0000000..71387e6 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachine.java @@ -0,0 +1,69 @@ +/* + * 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; + +/** + * A virtual machine that is valid for your subscription. + */ +@AutoValue +public abstract class VirtualMachine { + + /** + * The id of the virtual machine. + */ + public abstract String id(); + + /** + * The name of the virtual machine + */ + public abstract String name(); + + /** + * The type of the virtual machine . + */ + public abstract String type(); + + /** + * The localized name of the virtual machine . + */ + public abstract String location(); + + /** + * Specifies the tags of the vm + */ + @Nullable + public abstract Map<String, String> tags(); + + /** + * Specifies the properties of the vm + */ + public abstract VirtualMachineProperties properties(); + + @SerializedNames({"id", "name", "type", "location", "tags", "properties"}) + public static VirtualMachine create(final String id, final String name, final String type, final String location, + @Nullable final Map<String, String> tags, VirtualMachineProperties properties) { + + return new AutoValue_VirtualMachine(id, name, location, type, tags == null ? null : ImmutableMap.copyOf(tags), properties); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineInstance.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineInstance.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineInstance.java new file mode 100644 index 0000000..b0ed6d5 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineInstance.java @@ -0,0 +1,72 @@ +/* + * 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 java.util.List; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import java.util.Date; + +/** + * A virtual machine instance view that is valid for your subscription. + */ +@AutoValue +public abstract class VirtualMachineInstance { + + @AutoValue + public abstract static class VirtualMachineStatus { + + @Nullable + public abstract String code(); + + @Nullable + public abstract String level(); + + @Nullable + public abstract String displayStatus(); + + @Nullable + public abstract Date time(); + + @SerializedNames({"code", "level", "displayStatus", "time"}) + public static VirtualMachineStatus create(final String code, final String level, final String displayStatus, + final Date time) { + + return new AutoValue_VirtualMachineInstance_VirtualMachineStatus(code, level, displayStatus, time); + } + } + + @Nullable + public abstract String platformUpdateDomain(); + + @Nullable + public abstract String platformFaultDomain(); + + @Nullable + public abstract List<VirtualMachineStatus> statuses(); + + + @SerializedNames({"platformUpdateDomain", "platformFaultDomain", "statuses"}) + public static VirtualMachineInstance create(final String platformUpdateDomain, final String platformFaultDomain, + final List<VirtualMachineStatus> statuses) { + + return new AutoValue_VirtualMachineInstance(platformUpdateDomain, platformFaultDomain, statuses == null ? null : ImmutableList.copyOf(statuses)); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineProperties.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineProperties.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineProperties.java new file mode 100644 index 0000000..73afd14 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualMachineProperties.java @@ -0,0 +1,133 @@ +/* + * 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; + +/** + * A virtual machine properties for the virtual machine. + */ +@AutoValue +public abstract class VirtualMachineProperties { + + /** + * The id of the virtual machine. + */ + @Nullable + public abstract String vmId(); + + /** + * The license type of the virtual machine. + */ + @Nullable + public abstract String licenseType(); + + /** + * The availability set of the virtual machine + */ + @Nullable + public abstract AvailabilitySet availabilitySet(); + + /** + * The hardware Profile of the virtual machine . + */ + @Nullable + public abstract HardwareProfile hardwareProfile(); + + /** + * The Storage Profile of the virtual machine . + */ + @Nullable + public abstract StorageProfile storageProfile(); + + /** + * The OS Profile of the virtual machine . + */ + @Nullable + public abstract OSProfile osProfile(); + + /** + * The network profile of the VM + */ + @Nullable + public abstract NetworkProfile networkProfile(); + + /** + * The diagnostics profile of the VM + */ + @Nullable + public abstract DiagnosticsProfile diagnosticsProfile(); + + /** + * The provisioning state of the VM + */ + @Nullable + public abstract String provisioningState(); + + @SerializedNames({"vmId", "licenseType", "availabilitySet", "hardwareProfile", "storageProfile", "osProfile", + "networkProfile", "diagnosticsProfile", "provisioningState"}) + public static VirtualMachineProperties create(final String vmId, + final String licenseType, + final AvailabilitySet availabilitySet, + final HardwareProfile hardwareProfile, + final StorageProfile storageProfile, + final OSProfile osProfile, + final NetworkProfile networkProfile, + final DiagnosticsProfile diagnosticsProfile, + final String provisioningState) { + return builder() + .vmId(vmId) + .licenseType(licenseType) + .availabilitySet(availabilitySet) + .hardwareProfile(hardwareProfile) + .storageProfile(storageProfile) + .osProfile(osProfile) + .networkProfile(networkProfile) + .diagnosticsProfile(diagnosticsProfile) + .provisioningState(provisioningState) + .build(); + } + + public static Builder builder() { + return new AutoValue_VirtualMachineProperties.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder vmId(String vmId); + + public abstract Builder licenseType(String licenseType); + + public abstract Builder availabilitySet(AvailabilitySet availabilitySet); + + public abstract Builder hardwareProfile(HardwareProfile hardwareProfile); + + public abstract Builder storageProfile(StorageProfile storageProfile); + + public abstract Builder osProfile(OSProfile osProfile); + + public abstract Builder networkProfile(NetworkProfile networkProfile); + + public abstract Builder diagnosticsProfile(DiagnosticsProfile diagnosticsProfile); + + public abstract Builder provisioningState(String provisioningState); + + public abstract VirtualMachineProperties build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java index a7af6ec..d5eddf0 100644 --- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VirtualNetwork.java @@ -20,6 +20,7 @@ import static com.google.common.collect.ImmutableList.copyOf; import java.util.Map; import java.util.List; +import com.google.common.collect.ImmutableList; import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableMap; @@ -36,7 +37,7 @@ public abstract class VirtualNetwork { @SerializedNames({"addressPrefixes"}) public static AddressSpace create(final List<String> addressPrefixes) { - return new AutoValue_VirtualNetwork_AddressSpace(copyOf(addressPrefixes)); + return new AutoValue_VirtualNetwork_AddressSpace(addressPrefixes == null ? ImmutableList.<String>of() : ImmutableList.copyOf(addressPrefixes)); } } @@ -79,7 +80,14 @@ public abstract class VirtualNetwork { public abstract Builder subnets(List<Subnet> subnets); - public abstract VirtualNetworkProperties build(); + abstract List<Subnet> subnets(); + + abstract VirtualNetworkProperties autoBuild(); + + public VirtualNetworkProperties build() { + subnets(subnets() != null ? ImmutableList.copyOf(subnets()) : null); + return autoBuild(); + } } } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApi.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApi.java new file mode 100644 index 0000000..c7c665d --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkInterfaceCardApi.java @@ -0,0 +1,78 @@ +/* + * 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.NetworkInterfaceCard; +import org.jclouds.azurecompute.arm.domain.NetworkInterfaceCardProperties; +import org.jclouds.azurecompute.arm.functions.FalseOn204; +import org.jclouds.oauth.v2.filters.OAuthFilter; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.QueryParams; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.binders.BindToJsonPayload; + +import javax.inject.Named; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.MediaType; +import java.util.List; +import java.util.Map; + +@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkInterfaces") +@QueryParams(keys = "api-version", values = "2015-06-15") +@RequestFilters(OAuthFilter.class) +@Consumes(MediaType.APPLICATION_JSON) + +public interface NetworkInterfaceCardApi { + + @Named("networkinterfacecard:list") + @SelectJson("value") + @GET + @Fallback(EmptyListOnNotFoundOr404.class) + List<NetworkInterfaceCard> list(); + + @Named("networkinterfacecard:create_or_update") + @Path("/{networkinterfacecardname}") + @MapBinder(BindToJsonPayload.class) + @PUT + NetworkInterfaceCard createOrUpdate(@PathParam("networkinterfacecardname") String networkinterfacecardname, + @PayloadParam("location") String location, + @PayloadParam("properties") NetworkInterfaceCardProperties properties, + @PayloadParam("tags") Map<String, String> tags); + + @Named("networkinterfacecard:get") + @Path("/{networkinterfacecardname}") + @GET + @Fallback(NullOnNotFoundOr404.class) + NetworkInterfaceCard get(@PathParam("networkinterfacecardname") String networkinterfacecardname); + + @Named("networkinterfacecard:delete") + @Path("/{networkinterfacecardname}") + @DELETE + @ResponseParser(FalseOn204.class) + boolean delete(@PathParam("networkinterfacecardname") String networkinterfacecardname); +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3be36289/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApi.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApi.java new file mode 100644 index 0000000..2e19fe2 --- /dev/null +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/PublicIPAddressApi.java @@ -0,0 +1,78 @@ +/* + * 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.PublicIPAddress; +import org.jclouds.azurecompute.arm.domain.PublicIPAddressProperties; +import org.jclouds.azurecompute.arm.functions.FalseOn204; +import org.jclouds.oauth.v2.filters.OAuthFilter; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.QueryParams; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.binders.BindToJsonPayload; + +import javax.inject.Named; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.MediaType; +import java.util.List; +import java.util.Map; + +@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/publicIPAddresses") +@QueryParams(keys = "api-version", values = "2015-06-15") +@RequestFilters(OAuthFilter.class) +@Consumes(MediaType.APPLICATION_JSON) + +public interface PublicIPAddressApi { + + @Named("publicipaddress:list") + @SelectJson("value") + @GET + @Fallback(EmptyListOnNotFoundOr404.class) + List<PublicIPAddress> list(); + + @Named("publicipaddress:create_or_update") + @Path("/{publicipaddressname}") + @MapBinder(BindToJsonPayload.class) + @PUT + PublicIPAddress createOrUpdate(@PathParam("publicipaddressname") String publicipaddressname, + @PayloadParam("location") String location, + @PayloadParam("tags") Map<String, String> tags, + @PayloadParam("properties") PublicIPAddressProperties properties); + + @Named("publicipaddress:get") + @Path("/{publicipaddressname}") + @GET + @Fallback(NullOnNotFoundOr404.class) + PublicIPAddress get(@PathParam("publicipaddressname") String publicipaddressname); + + @Named("publicipaddress:delete") + @Path("/{publicipaddressname}") + @DELETE + @ResponseParser(FalseOn204.class) + boolean delete(@PathParam("publicipaddressname") String publicipaddressname); +}
