Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/SDKs/Compute/Compute.Tests/ScenarioTests/VMImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,68 @@ public void TestVMImageGet()
}
}

[Fact]
public void TestVMImageAutomaticOSUpgradeProperties()
{
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
ComputeManagementClient _pirClient = ComputeManagementTestUtilities.GetComputeManagementClient(context,
new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK });

// Validate if images supporting automatic OS upgrades return
// AutomaticOSUpgradeProperties.AutomaticOSUpgradeSupported = true in GET VMImageVesion call
string imagePublisher = "MicrosoftWindowsServer";
string imageOffer = "WindowsServer";
string imageSku = "2016-Datacenter";
string[] availableWindowsServerImageVersions =_pirClient.VirtualMachineImages.List(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku).Select(t => t.Name).ToArray();

string firstVersion = availableWindowsServerImageVersions.First();
string lastVersion = null;
if (availableWindowsServerImageVersions.Length >= 2)
{
lastVersion = availableWindowsServerImageVersions.Last();
}

var vmimage = _pirClient.VirtualMachineImages.Get(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku, firstVersion);
Assert.True(vmimage.AutomaticOSUpgradeProperties.AutomaticOSUpgradeSupported);

if (!string.IsNullOrEmpty(lastVersion))
{
vmimage = _pirClient.VirtualMachineImages.Get(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku, lastVersion);
Assert.True(vmimage.AutomaticOSUpgradeProperties.AutomaticOSUpgradeSupported);
}

// Validate if image not whitelisted to support automatic OS upgrades, return
// AutomaticOSUpgradeProperties.AutomaticOSUpgradeSupported = false in GET VMImageVesion call
imagePublisher = "Canonical";
imageOffer = "UbuntuServer";
imageSku = "18.10-DAILY";
string[] availableUbuntuImageVersions = _pirClient.VirtualMachineImages.List(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku).Select(t => t.Name).ToArray();

firstVersion = availableUbuntuImageVersions.First();
lastVersion = null;
if (availableUbuntuImageVersions.Length >= 2)
{
lastVersion = availableUbuntuImageVersions.Last();
}

vmimage = _pirClient.VirtualMachineImages.Get(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku, firstVersion);
Assert.False(vmimage.AutomaticOSUpgradeProperties.AutomaticOSUpgradeSupported);

if (!string.IsNullOrEmpty(lastVersion))
{
vmimage = _pirClient.VirtualMachineImages.Get(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku, lastVersion);
Assert.False(vmimage.AutomaticOSUpgradeProperties.AutomaticOSUpgradeSupported);
}
}
}

[Fact]
public void TestVMImageListNoFilter()
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Microsoft.Azure.Management.Compute.Models
{
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Describes automatic OS upgrade properties on the image.
/// </summary>
public partial class AutomaticOSUpgradeProperties
{
/// <summary>
/// Initializes a new instance of the AutomaticOSUpgradeProperties
/// class.
/// </summary>
public AutomaticOSUpgradeProperties()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the AutomaticOSUpgradeProperties
/// class.
/// </summary>
/// <param name="automaticOSUpgradeSupported">Specifies whether
/// automatic OS upgrade is supported on the image.</param>
public AutomaticOSUpgradeProperties(bool automaticOSUpgradeSupported)
{
AutomaticOSUpgradeSupported = automaticOSUpgradeSupported;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets specifies whether automatic OS upgrade is supported on
/// the image.
/// </summary>
[JsonProperty(PropertyName = "automaticOSUpgradeSupported")]
public bool AutomaticOSUpgradeSupported { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
//Nothing to validate
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ public VirtualMachineImage()
/// virtual machine. For more information about using tags, see [Using
/// tags to organize your Azure
/// resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md).</param>
public VirtualMachineImage(string name, string location, string id = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), PurchasePlan plan = default(PurchasePlan), OSDiskImage osDiskImage = default(OSDiskImage), IList<DataDiskImage> dataDiskImages = default(IList<DataDiskImage>))
public VirtualMachineImage(string name, string location, string id = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), PurchasePlan plan = default(PurchasePlan), OSDiskImage osDiskImage = default(OSDiskImage), IList<DataDiskImage> dataDiskImages = default(IList<DataDiskImage>), AutomaticOSUpgradeProperties automaticOSUpgradeProperties = default(AutomaticOSUpgradeProperties))
: base(name, location, id, tags)
{
Plan = plan;
OsDiskImage = osDiskImage;
DataDiskImages = dataDiskImages;
AutomaticOSUpgradeProperties = automaticOSUpgradeProperties;
CustomInit();
}

Expand All @@ -71,6 +72,11 @@ public VirtualMachineImage()
[JsonProperty(PropertyName = "properties.dataDiskImages")]
public IList<DataDiskImage> DataDiskImages { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "properties.automaticOSUpgradeProperties")]
public AutomaticOSUpgradeProperties AutomaticOSUpgradeProperties { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
Expand All @@ -88,6 +94,10 @@ public override void Validate()
{
OsDiskImage.Validate();
}
if (AutomaticOSUpgradeProperties != null)
{
AutomaticOSUpgradeProperties.Validate();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static IEnumerable<Tuple<string, string, string>> ApiInfo_ComputeManageme
public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=E:\\hylee-sdk\\september\\src\\SDKs";
public static readonly String GithubForkName = "Azure";
public static readonly String GithubBranchName = "master";
public static readonly String GithubCommidId = "5ceecc250e5bd51b9d1b087a566c3563dd8e857e";
public static readonly String GithubCommidId = "3f094a4eb44682f1608aaf836ca9ad8a8b15b6b9";
public static readonly String CodeGenerationErrors = "";
public static readonly String GithubRepoName = "azure-rest-api-specs";
// END: Code Generation Metadata Section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<PropertyGroup>
<PackageId>Microsoft.Azure.Management.Compute</PackageId>
<Description>Provides developers with libraries for the updated compute platform under Azure Resource manager to deploy virtual machine, virtual machine extensions and availability set management capabilities. Launch, restart, scale, capture and manage VMs, VM Extensions and more. Note: This client library is for Virtual Machines under Azure Resource Manager.</Description>
<Version>23.0.0</Version>
<Version>23.1.0</Version>
<AssemblyName>Microsoft.Azure.Management.Compute</AssemblyName>
<PackageTags>management;virtual machine;compute;</PackageTags>
<PackageReleaseNotes>
<![CDATA[
This is a public release of the Azure Compute SDK. Included with this release is upgrading Compute API version to 2018-10-01 and adding shared gallery APIs, List VM by Location API, Diff disk support, and Ultra SSD support.
This is a public release of the Azure Compute SDK. Included with this release is adding auto OS upgrade policy to VM image.
]]>
</PackageReleaseNotes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Compute Resources.")]

[assembly: AssemblyVersion("23.0.0.0")]
[assembly: AssemblyFileVersion("23.0.0.0")]
[assembly: AssemblyFileVersion("23.1.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
Expand Down
4 changes: 2 additions & 2 deletions src/SDKs/_metadata/compute_resource-manager.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Commencing code generation
Generating CSharp code
Executing AutoRest command
cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=E:\hylee-sdk\september\src\SDKs
2018-09-27 21:35:59 UTC
2018-09-28 22:48:43 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
Commit: 5ceecc250e5bd51b9d1b087a566c3563dd8e857e
Commit: 3f094a4eb44682f1608aaf836ca9ad8a8b15b6b9
AutoRest information
Requested version: latest
Bootstrapper version: autorest@2.0.4283