Skip to content
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

Machine Learning Compute: Add optional deleteAll parameter #3959

Merged
merged 2 commits into from
Jan 4, 2018
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
7 changes: 7 additions & 0 deletions src/SDKs/MachineLearningCompute/AzSdk.RP.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file-->
<PropertyGroup>
<AzureApiTag>MachineLearningCompute_2017-08-01-preview;</AzureApiTag>
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class MachineLearningComputeTestBase : TestBase, IDisposable
public string Location { get; set; }
public string TestName { get; set; }
public string ResourceGroupName { get; set; }
public string ManagedByResourceGroupName { get; set; }
public string ClusterName { get; set; }

public MachineLearningComputeTestBase(MockContext context, string testName)
Expand Down Expand Up @@ -89,7 +90,11 @@ public OperationalizationCluster CreateCluster(string description = "Test cluste
}
};

return Client.OperationalizationClusters.CreateOrUpdate(ResourceGroupName, ClusterName, newCluster);
var createdCluster = Client.OperationalizationClusters.CreateOrUpdate(ResourceGroupName, ClusterName, newCluster);

ManagedByResourceGroupName = createdCluster.ContainerRegistry.ResourceId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[3];

return createdCluster;
}

public OperationalizationCluster CreateClusterWithoutOrchestratorProperties(string description = "Test cluster",
Expand Down Expand Up @@ -139,6 +144,5 @@ private string GetServicePrincipalSecret()
}
return servicePrincipalSecret;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Xunit.Abstractions;
using Microsoft.Azure.Management.MachineLearningCompute.Models;
using System.Linq;
using Microsoft.Azure.Management.ResourceManager;
using Microsoft.Azure.Management.ResourceManager.Models;
using System;

namespace MachineLearningCompute.Tests
Expand Down Expand Up @@ -101,7 +103,7 @@ public void ListClustersInResourceGroup()

var clusterNames = testBase.Client.OperationalizationClusters.ListByResourceGroup(resourceGroup.Name).Select(cluster => cluster.Name);

Assert.True(clusterNames.Contains(createdCluster.Name));
Assert.Contains(createdCluster.Name, clusterNames);
}
}

Expand All @@ -116,7 +118,7 @@ public void ListClustersBySubscriptionId()

var clusterNames = testBase.Client.OperationalizationClusters.ListBySubscriptionId().Select(cluster => cluster.Name);

Assert.True(clusterNames.Contains(createdCluster.Name));
Assert.Contains(createdCluster.Name, clusterNames);
}
}

Expand Down Expand Up @@ -168,5 +170,20 @@ public void UpdateSystemServices()
Assert.NotNull(updateResponse.UpdateCompletedOn);
}
}

[Fact]
public void DeleteAllResources()
{
using (var context = MockContext.Start(this.GetType().FullName))
using (var testBase = new MachineLearningComputeTestBase(context, testNamePrefix + "-deleteall"))
{
var resourceGroup = testBase.CreateResourceGroup();
var createdCluster = testBase.CreateCluster(clusterType: "Local");

var deleteResponse = testBase.Client.OperationalizationClusters.Delete(resourceGroup.Name, createdCluster.Name, deleteAll: true);

Assert.False(testBase.ResourcesClient.ResourceGroups.CheckExistence(testBase.ManagedByResourceGroupName));
}
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public partial interface IOperationalizationClustersOperations
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -129,7 +132,7 @@ public partial interface IOperationalizationClustersOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, bool? deleteAll = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Gets the credentials for the specified cluster such as Storage, ACR
/// and ACS credentials. This is a long running operation because it
Expand Down Expand Up @@ -292,6 +295,9 @@ public partial interface IOperationalizationClustersOperations
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -304,7 +310,7 @@ public partial interface IOperationalizationClustersOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, bool? deleteAll = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Updates system services in a cluster.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ public SslConfiguration()
/// </summary>
/// <param name="status">SSL status. Allowed values are Enabled and
/// Disabled. Possible values include: 'Enabled', 'Disabled'</param>
/// <param name="cert">The SSL cert data in PEM format encoded as
/// base64 string</param>
/// <param name="key">The SSL key data in PEM format encoded as base64
/// string. This is not returned in response of GET/PUT on the
/// resource. To see this please call listKeys API.</param>
/// <param name="cert">The SSL cert data in PEM format.</param>
/// <param name="key">The SSL key data in PEM format. This is not
/// returned in response of GET/PUT on the resource. To see this please
/// call listKeys API.</param>
/// <param name="cname">The CName of the certificate.</param>
public SslConfiguration(string status = default(string), string cert = default(string), string key = default(string), string cname = default(string))
{
Expand All @@ -60,16 +59,15 @@ public SslConfiguration()
public string Status { get; set; }

/// <summary>
/// Gets or sets the SSL cert data in PEM format encoded as base64
/// string
/// Gets or sets the SSL cert data in PEM format.
/// </summary>
[JsonProperty(PropertyName = "cert")]
public string Cert { get; set; }

/// <summary>
/// Gets or sets the SSL key data in PEM format encoded as base64
/// string. This is not returned in response of GET/PUT on the
/// resource. To see this please call listKeys API.
/// Gets or sets the SSL key data in PEM format. This is not returned
/// in response of GET/PUT on the resource. To see this please call
/// listKeys API.
/// </summary>
[JsonProperty(PropertyName = "key")]
public string Key { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,16 +542,19 @@ internal OperationalizationClustersOperations(MachineLearningComputeManagementCl
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, bool? deleteAll = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders> _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, customHeaders, cancellationToken).ConfigureAwait(false);
AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders> _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, deleteAll, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}

Expand Down Expand Up @@ -1693,6 +1696,9 @@ internal OperationalizationClustersOperations(MachineLearningComputeManagementCl
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -1711,7 +1717,7 @@ internal OperationalizationClustersOperations(MachineLearningComputeManagementCl
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationHeaderResponse<OperationalizationClustersDeleteHeaders>> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, bool? deleteAll = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
Expand Down Expand Up @@ -1768,6 +1774,7 @@ internal OperationalizationClustersOperations(MachineLearningComputeManagementCl
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("clusterName", clusterName);
tracingParameters.Add("deleteAll", deleteAll);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
}
Expand All @@ -1782,6 +1789,10 @@ internal OperationalizationClustersOperations(MachineLearningComputeManagementCl
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (deleteAll != null)
{
_queryParameters.Add(string.Format("deleteAll={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(deleteAll, Client.SerializationSettings).Trim('"'))));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,12 @@ public static OperationalizationCluster Update(this IOperationalizationClustersO
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
public static OperationalizationClustersDeleteHeaders Delete(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName)
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
public static OperationalizationClustersDeleteHeaders Delete(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName, bool? deleteAll = default(bool?))
{
return operations.DeleteAsync(resourceGroupName, clusterName).GetAwaiter().GetResult();
return operations.DeleteAsync(resourceGroupName, clusterName, deleteAll).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -186,12 +189,15 @@ public static OperationalizationClustersDeleteHeaders Delete(this IOperationaliz
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<OperationalizationClustersDeleteHeaders> DeleteAsync(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<OperationalizationClustersDeleteHeaders> DeleteAsync(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName, bool? deleteAll = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, deleteAll, null, cancellationToken).ConfigureAwait(false))
{
return _result.Headers;
}
Expand Down Expand Up @@ -453,9 +459,12 @@ public static OperationalizationCluster BeginCreateOrUpdate(this IOperationaliza
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
public static OperationalizationClustersDeleteHeaders BeginDelete(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName)
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
public static OperationalizationClustersDeleteHeaders BeginDelete(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName, bool? deleteAll = default(bool?))
{
return operations.BeginDeleteAsync(resourceGroupName, clusterName).GetAwaiter().GetResult();
return operations.BeginDeleteAsync(resourceGroupName, clusterName, deleteAll).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -470,12 +479,15 @@ public static OperationalizationClustersDeleteHeaders BeginDelete(this IOperatio
/// <param name='clusterName'>
/// The name of the cluster.
/// </param>
/// <param name='deleteAll'>
/// If true, deletes all resources associated with this cluster.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<OperationalizationClustersDeleteHeaders> BeginDeleteAsync(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<OperationalizationClustersDeleteHeaders> BeginDeleteAsync(this IOperationalizationClustersOperations operations, string resourceGroupName, string clusterName, bool? deleteAll = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, deleteAll, null, cancellationToken).ConfigureAwait(false))
{
return _result.Headers;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

using System;
using System.Collections.Generic;
using System.Linq;

internal static partial class SdkInfo
{
public static IEnumerable<Tuple<string, string, string>> ApiInfo_MachineLearningComputeManagementClient
{
get
{
return new Tuple<string, string, string>[]
{
new Tuple<string, string, string>("MachineLearningCompute", "MachineLearningCompute", "2017-08-01-preview"),
new Tuple<string, string, string>("MachineLearningCompute", "OperationalizationClusters", "2017-08-01-preview"),
}.AsEnumerable();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<PackageId>Microsoft.Azure.Management.MachineLearningCompute</PackageId>
<Description>Provides developers with a library to create and manage machine learning compute resources.</Description>
<AssemblyName>Microsoft.Azure.Management.MachineLearningCompute</AssemblyName>
<Version>0.2.0</Version>
<Version>0.3.0</Version>
<PackageTags>Microsoft Azure Machine Learning Compute management;</PackageTags>
<PackageReleaseNotes>Orchestrator properties and orchestrator service principal are optional since the resource provider will create one if not provided.</PackageReleaseNotes>
<PackageReleaseNotes>Added optional 'deleteAll' parameter to delete all resources associated with the cluster.</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net452;netstandard1.4</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
2017-10-31 21:56:22 UTC
2017-12-18 18:20:26 UTC

1) azure-rest-api-specs repository information
GitHub user: Azure
Branch: current
Commit: 5ceb9c24160362fca070a168708e24b8ce3dc5b0
Commit: ca7dadf950700baa6a9fde9e78bd80d4498213f4

2) AutoRest information
Requested version: latest
Bootstrapper version: C:\Users\sthutchi\AppData\Roaming\npm `-- [email protected].4166
Latest installed version: 2.0.4168
Bootstrapper version: C:\Users\sthutchi\AppData\Roaming\npm `-- [email protected].4215
Latest installed version: