Skip to content

Commit

Permalink
Add $expand to AvSet ListBySubscription API (#7447)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyonholee authored and isra-fel committed Sep 4, 2019
1 parent 0348549 commit 81cb454
Show file tree
Hide file tree
Showing 15 changed files with 1,065 additions and 8,500 deletions.
6 changes: 3 additions & 3 deletions eng/mgmt/mgmtmetadata/compute_resource-manager.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ AutoRest installed successfully.
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=C:\Users\jopolloc\codebase\azure-sdk-for-net\sdk
2019-08-23 03:36:40 UTC
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=D:\hylee-sdk\avset\sdk
2019-08-30 19:41:37 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
Commit: 86796b0f17d82b046fddbc7cce463a159774f6d6
Commit: 6359c5dac93947b24007afd9c569e23e92848ea5
AutoRest information
Requested version: latest
Bootstrapper version: [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,9 @@ internal AvailabilitySetsOperations(ComputeManagementClient client)
/// <summary>
/// Lists all availability sets in a subscription.
/// </summary>
/// <param name='expand'>
/// The expand expression to apply to the operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -861,7 +864,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<AvailabilitySet>>> ListBySubscriptionWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<IPage<AvailabilitySet>>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
Expand All @@ -876,6 +879,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters);
}
Expand All @@ -888,6 +892,10 @@ internal AvailabilitySetsOperations(ComputeManagementClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (expand != null)
{
_queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,12 @@ public static AvailabilitySet Get(this IAvailabilitySetsOperations operations, s
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
public static IPage<AvailabilitySet> ListBySubscription(this IAvailabilitySetsOperations operations)
/// <param name='expand'>
/// The expand expression to apply to the operation.
/// </param>
public static IPage<AvailabilitySet> ListBySubscription(this IAvailabilitySetsOperations operations, string expand = default(string))
{
return operations.ListBySubscriptionAsync().GetAwaiter().GetResult();
return operations.ListBySubscriptionAsync(expand).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -209,12 +212,15 @@ public static IPage<AvailabilitySet> ListBySubscription(this IAvailabilitySetsOp
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='expand'>
/// The expand expression to apply to the operation.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IPage<AvailabilitySet>> ListBySubscriptionAsync(this IAvailabilitySetsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<IPage<AvailabilitySet>> ListBySubscriptionAsync(this IAvailabilitySetsOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ public partial interface IAvailabilitySetsOperations
/// <summary>
/// Lists all availability sets in a subscription.
/// </summary>
/// <param name='expand'>
/// The expand expression to apply to the operation.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -144,7 +147,7 @@ public partial interface IAvailabilitySetsOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<IPage<AvailabilitySet>>> ListBySubscriptionWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<IPage<AvailabilitySet>>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Lists all availability sets in a resource group.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public static IEnumerable<Tuple<string, string, string>> ApiInfo_ComputeManageme
// BEGIN: Code Generation Metadata Section
public static readonly String AutoRestVersion = "latest";
public static readonly String AutoRestBootStrapperVersion = "[email protected]";
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=C:\\Users\\jopolloc\\codebase\\azure-sdk-for-net\\sdk";
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=D:\\hylee-sdk\\avset\\sdk";
public static readonly String GithubForkName = "Azure";
public static readonly String GithubBranchName = "master";
public static readonly String GithubCommidId = "86796b0f17d82b046fddbc7cce463a159774f6d6";
public static readonly String GithubCommidId = "6359c5dac93947b24007afd9c569e23e92848ea5";
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>29.0.0</Version>
<Version>29.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 s updating DiskRP API version to 2019-03-01.
This is a public release of the Azure Compute SDK. Included with this release is adding $expand option for Availability Set List by Subscription API.
]]>
</PackageReleaseNotes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[assembly: AssemblyTitle("Microsoft Azure Compute Management Library")]
[assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Compute Resources.")]

[assembly: AssemblyVersion("29.0.0.0")]
[assembly: AssemblyVersion("29.1.0.0")]
[assembly: AssemblyFileVersion("29.0.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,35 @@ private void VerifyListAvailabilitySetsInSubscription()
IPage<AvailabilitySet> response = computeClient.AvailabilitySets.ListBySubscription();
Assert.Null(response.NextPageLink);

foreach (AvailabilitySet availabilitySet in response)
{
if (availabilitySet.Name == availabilitySet1Name)
{
Assert.Equal(inputAvailabilitySet1.Location, availabilitySet.Location);
Assert.Null(availabilitySet.VirtualMachines);
}
else if (availabilitySet.Name == availabilitySet2Name)
{
Assert.Equal(inputAvailabilitySet2.Location, availabilitySet.Location);
Assert.Null(availabilitySet.VirtualMachines);
}
}

response = computeClient.AvailabilitySets.ListBySubscription("virtualMachines/$ref");
int validationCount = 0;

foreach (AvailabilitySet availabilitySet in response)
{
Assert.NotNull(availabilitySet.VirtualMachines);
if (availabilitySet.Name == availabilitySet1Name)
{
Assert.Equal(0, availabilitySet.VirtualMachines.Count);
ValidateResults(outputAvailabilitySet1, inputAvailabilitySet1, resourceGroup1Name, availabilitySet1Name, defaultFD, defaultUD);
validationCount++;
}
else if (availabilitySet.Name == availabilitySet2Name)
{
Assert.Equal(0, availabilitySet.VirtualMachines.Count);
ValidateResults(outputAvailabilitySet2, inputAvailabilitySet2, resourceGroup2Name, availabilitySet2Name, defaultFD, defaultUD);
validationCount++;
}
Expand Down
Loading

0 comments on commit 81cb454

Please sign in to comment.