-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some VM image code #688
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
101 changes: 98 additions & 3 deletions
101
azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,107 @@ | ||
package com.microsoft.azure.management.compute; | ||
|
||
import com.microsoft.azure.management.compute.implementation.api.AvailabilitySetInner; | ||
import com.microsoft.azure.SubResource; | ||
import com.microsoft.azure.management.compute.implementation.KnownVirtualMachineImage; | ||
import com.microsoft.azure.management.compute.implementation.api.*; | ||
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; | ||
|
||
import java.util.List; | ||
|
||
public interface VirtualMachine extends | ||
GroupableResource, | ||
Refreshable<AvailabilitySet>, | ||
Wrapper<AvailabilitySetInner> { | ||
Refreshable<VirtualMachine>, | ||
Wrapper<VirtualMachineInner> { | ||
/** | ||
* Get the plan value. | ||
* | ||
* @return the plan value | ||
*/ | ||
Plan plan(); | ||
|
||
/** | ||
* Get the hardwareProfile value. | ||
* | ||
* @return the hardwareProfile value | ||
*/ | ||
HardwareProfile hardwareProfile(); | ||
|
||
/** | ||
* Get the storageProfile value. | ||
* | ||
* @return the storageProfile value | ||
*/ | ||
StorageProfile storageProfile(); | ||
|
||
/** | ||
* Get the osProfile value. | ||
* | ||
* @return the osProfile value | ||
*/ | ||
OSProfile osProfile(); | ||
|
||
/** | ||
* Get the networkProfile value. | ||
* | ||
* @return the networkProfile value | ||
*/ | ||
NetworkProfile networkProfile(); | ||
|
||
/** | ||
* Get the diagnosticsProfile value. | ||
* | ||
* @return the diagnosticsProfile value | ||
*/ | ||
DiagnosticsProfile diagnosticsProfile(); | ||
|
||
/** | ||
* Get the availabilitySet value. | ||
* | ||
* @return the availabilitySet value | ||
*/ | ||
SubResource availabilitySet(); | ||
|
||
/** | ||
* Get the provisioningState value. | ||
* | ||
* @return the provisioningState value | ||
*/ | ||
String provisioningState(); | ||
|
||
/** | ||
* Get the instanceView value. | ||
* | ||
* @return the instanceView value | ||
*/ | ||
VirtualMachineInstanceView instanceView(); | ||
|
||
/** | ||
* Get the licenseType value. | ||
* | ||
* @return the licenseType value | ||
*/ | ||
String licenseType(); | ||
|
||
/** | ||
* Get the resources value. | ||
* | ||
* @return the resources value | ||
*/ | ||
List<VirtualMachineExtensionInner> resources(); | ||
|
||
interface DefinitionBlank extends GroupableResource.DefinitionWithRegion<DefinitionWithRegion> { | ||
} | ||
|
||
interface DefinitionWithRegion extends GroupableResource.DefinitionWithGroup<DefinitionWithGroup> { | ||
} | ||
|
||
interface DefinitionWithGroup { | ||
DefinitionWithImage withImage(String publisher, String offer, String sku, String version); | ||
DefinitionWithImage withLatestImage(String publisher, String offer, String sku); | ||
DefinitionWithImage withKnownImage(KnownVirtualMachineImage image); | ||
} | ||
|
||
interface DefinitionWithImage { | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...gmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.microsoft.azure.management.compute; | ||
|
||
import com.microsoft.azure.management.compute.implementation.api.DataDiskImage; | ||
import com.microsoft.azure.management.compute.implementation.api.OSDiskImage; | ||
import com.microsoft.azure.management.compute.implementation.api.PurchasePlan; | ||
import com.microsoft.azure.management.compute.implementation.api.VirtualMachineImageInner; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; | ||
|
||
import java.util.List; | ||
|
||
public interface VirtualMachineImage extends | ||
Wrapper<VirtualMachineImageInner> { | ||
String location(); | ||
String publisher(); | ||
String offer(); | ||
String sku(); | ||
String version(); | ||
PurchasePlan plan(); | ||
OSDiskImage osDiskImage(); | ||
List<DataDiskImage> dataDiskImages(); | ||
} |
21 changes: 21 additions & 0 deletions
21
...mt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.microsoft.azure.management.compute; | ||
|
||
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsDeletingByGroup; | ||
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByGroup; | ||
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsListingByGroup; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeleting; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; | ||
|
||
public interface VirtualMachineImages extends | ||
SupportsListing<VirtualMachine>, | ||
SupportsListingByGroup<VirtualMachine>, | ||
SupportsGettingByGroup<VirtualMachine>, | ||
SupportsCreating<VirtualMachine>, | ||
SupportsDeleting, | ||
SupportsDeletingByGroup { | ||
interface InGroup extends | ||
SupportsListing<VirtualMachine>, | ||
SupportsCreating<VirtualMachine>, | ||
SupportsDeleting {} | ||
} | ||
37 changes: 37 additions & 0 deletions
37
.../java/com/microsoft/azure/management/compute/implementation/KnownVirtualMachineImage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.microsoft.azure.management.compute.implementation; | ||
|
||
import com.microsoft.azure.management.compute.VirtualMachineImage; | ||
|
||
public enum KnownVirtualMachineImage { | ||
UBUNTU_14_04_LTS(new VirtualMachineImageImpl( | ||
"Canonical", "UbuntuServer", "14.04.4-LTS", "14.04.201604060" | ||
)), | ||
UBUNTU_16_04_LTS(new VirtualMachineImageImpl( | ||
"Canonical", "UbuntuServer", "16.04.0-LTS", "16.04.201604203" | ||
)), | ||
WINDOWS_SERVER_2008_R2_SP1(new VirtualMachineImageImpl( | ||
"MicrosoftWindowsServer", "WindowsServer", "2008-R2-SP1", "2.0.20160430" | ||
)), | ||
WINDOWS_SERVER_2012_DATACENTER(new VirtualMachineImageImpl( | ||
"MicrosoftWindowsServer", "WindowsServer", "2012-Datacenter", "3.0.20160430" | ||
)), | ||
WINDOWS_SERVER_2012_R2_DATACENTER(new VirtualMachineImageImpl( | ||
"MicrosoftWindowsServer", "WindowsServer", "2012-R2-Datacenter", "4.0.20160430" | ||
)), | ||
WINDOWS_SERVER_2016_TECHNICAL_PREVIEW_WITH_CONTAINIERS(new VirtualMachineImageImpl( | ||
"MicrosoftWindowsServer", "WindowsServer", "2016-Technical-Preview-with-Containers", "2016.0.20151118" | ||
)), | ||
WINDOWS_SERVER_TECHNICAL_PREVIEW(new VirtualMachineImageImpl( | ||
"MicrosoftWindowsServer", "WindowsServer", "Windows-Server-Technical-Preview", "5.0.20160420" | ||
)); | ||
|
||
private final VirtualMachineImage image; | ||
|
||
KnownVirtualMachineImage(VirtualMachineImage image) { | ||
this.image = image; | ||
} | ||
|
||
public VirtualMachineImage image() { | ||
return this.image; | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
...n/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.microsoft.azure.management.compute.implementation; | ||
|
||
import com.microsoft.azure.management.compute.VirtualMachineImage; | ||
import com.microsoft.azure.management.compute.implementation.api.DataDiskImage; | ||
import com.microsoft.azure.management.compute.implementation.api.OSDiskImage; | ||
import com.microsoft.azure.management.compute.implementation.api.PurchasePlan; | ||
import com.microsoft.azure.management.compute.implementation.api.VirtualMachineImageInner; | ||
import com.microsoft.azure.management.resources.fluentcore.model.implementation.IndexableWrapperImpl; | ||
|
||
import java.util.List; | ||
|
||
class VirtualMachineImageImpl | ||
extends IndexableWrapperImpl<VirtualMachineImageInner> | ||
implements VirtualMachineImage { | ||
VirtualMachineImageImpl(String publisher, String offer, String sku, String version) { | ||
super(null, null); | ||
this.publisher = publisher; | ||
this.offer = offer; | ||
this.sku = sku; | ||
this.version = version; | ||
} | ||
|
||
VirtualMachineImageImpl(String publisher, String offer, String sku, String version, VirtualMachineImageInner innerObject) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, the name of the inner parameter in fluent models is "innerModel". |
||
super(innerObject.id(), innerObject); | ||
this.publisher = publisher; | ||
this.offer = offer; | ||
this.sku = sku; | ||
this.version = version; | ||
} | ||
|
||
private String publisher; | ||
private String offer; | ||
private String sku; | ||
private String version; | ||
|
||
@Override | ||
public String location() { | ||
return inner().location(); | ||
} | ||
|
||
@Override | ||
public String publisher() { | ||
return publisher; | ||
} | ||
|
||
@Override | ||
public String offer() { | ||
return offer; | ||
} | ||
|
||
@Override | ||
public String sku() { | ||
return sku; | ||
} | ||
|
||
@Override | ||
public String version() { | ||
return version; | ||
} | ||
|
||
@Override | ||
public PurchasePlan plan() { | ||
return inner().plan(); | ||
} | ||
|
||
@Override | ||
public OSDiskImage osDiskImage() { | ||
return inner().osDiskImage(); | ||
} | ||
|
||
@Override | ||
public List<DataDiskImage> dataDiskImages() { | ||
return inner().dataDiskImages(); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template parameter type should be "VirtualMachineImage" instead of "VirtualMachine"