diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostSettingOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostInsightOperations.cs similarity index 83% rename from src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostSettingOperations.cs rename to src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostInsightOperations.cs index c44848df3872..ce1840d6f6b1 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostSettingOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostInsightOperations.cs @@ -21,21 +21,22 @@ namespace Microsoft.Azure.Management.DevTestLabs using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using Microsoft.Rest.Azure.OData; using Microsoft.Rest.Azure; using Models; /// - /// CostSettingOperations operations. + /// CostInsightOperations operations. /// - internal partial class CostSettingOperations : IServiceOperations, ICostSettingOperations + internal partial class CostInsightOperations : IServiceOperations, ICostInsightOperations { /// - /// Initializes a new instance of the CostSettingOperations class. + /// Initializes a new instance of the CostInsightOperations class. /// /// /// Reference to the service client. /// - internal CostSettingOperations(DevTestLabsClient client) + internal CostInsightOperations(DevTestLabsClient client) { if (client == null) { @@ -50,7 +51,7 @@ internal CostSettingOperations(DevTestLabsClient client) public DevTestLabsClient Client { get; private set; } /// - /// Get cost setting. + /// List cost insights. /// /// /// The name of the resource group. @@ -58,8 +59,8 @@ internal CostSettingOperations(DevTestLabsClient client) /// /// The name of the lab. /// - /// - /// The name of the cost setting. + /// + /// OData parameters to apply to the operation. /// /// /// Headers that will be added to request. @@ -70,7 +71,7 @@ internal CostSettingOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (this.Client.SubscriptionId == null) { @@ -84,10 +85,6 @@ internal CostSettingOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } if (this.Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -99,20 +96,27 @@ internal CostSettingOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetResource", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costsettings/{name}").ToString(); + var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costinsights").ToString(); _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", Uri.EscapeDataString(name)); List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } if (this.Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); @@ -208,7 +212,7 @@ internal CostSettingOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -221,7 +225,7 @@ internal CostSettingOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } catch (JsonException ex) { @@ -241,7 +245,7 @@ internal CostSettingOperations(DevTestLabsClient client) } /// - /// Create or replace an existing cost setting. + /// Get cost insight. /// /// /// The name of the resource group. @@ -250,9 +254,7 @@ internal CostSettingOperations(DevTestLabsClient client) /// The name of the lab. /// /// - /// The name of the cost setting. - /// - /// + /// The name of the cost insight. /// /// /// Headers that will be added to request. @@ -263,7 +265,7 @@ internal CostSettingOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CostSetting costSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (this.Client.SubscriptionId == null) { @@ -281,10 +283,6 @@ internal CostSettingOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (costSetting == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "costSetting"); - } if (this.Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -299,13 +297,12 @@ internal CostSettingOperations(DevTestLabsClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); - tracingParameters.Add("costSetting", costSetting); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateResource", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetResource", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costsettings/{name}").ToString(); + var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costinsights/{name}").ToString(); _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); @@ -322,7 +319,7 @@ internal CostSettingOperations(DevTestLabsClient client) // Create HTTP transport objects HttpRequestMessage _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -351,12 +348,6 @@ internal CostSettingOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; - if(costSetting != null) - { - _requestContent = SafeJsonConvert.SerializeObject(costSetting, this.Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -377,7 +368,7 @@ internal CostSettingOperations(DevTestLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -412,7 +403,7 @@ internal CostSettingOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -425,25 +416,7 @@ internal CostSettingOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (JsonException ex) { @@ -463,7 +436,8 @@ internal CostSettingOperations(DevTestLabsClient client) } /// - /// Delete cost setting. + /// Refresh Lab's Cost Insight Data. This operation can take a while to + /// complete. /// /// /// The name of the resource group. @@ -472,7 +446,34 @@ internal CostSettingOperations(DevTestLabsClient client) /// The name of the lab. /// /// - /// The name of the cost setting. + /// The name of the cost insight. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRefreshDataWithHttpMessagesAsync( + resourceGroupName, labName, name, customHeaders, cancellationToken); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); + } + + /// + /// Refresh Lab's Cost Insight Data. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost insight. /// /// /// Headers that will be added to request. @@ -483,7 +484,7 @@ internal CostSettingOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (this.Client.SubscriptionId == null) { @@ -516,11 +517,11 @@ internal CostSettingOperations(DevTestLabsClient client) tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteResource", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRefreshData", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costsettings/{name}").ToString(); + var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costinsights/{name}/refreshData").ToString(); _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); @@ -537,7 +538,7 @@ internal CostSettingOperations(DevTestLabsClient client) // Create HTTP transport objects HttpRequestMessage _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -586,7 +587,7 @@ internal CostSettingOperations(DevTestLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -636,18 +637,10 @@ internal CostSettingOperations(DevTestLabsClient client) } /// - /// Modify properties of cost settings. + /// List cost insights. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the cost setting. - /// - /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -658,31 +651,11 @@ internal CostSettingOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> PatchResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CostSetting costSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (this.Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (costSetting == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "costSetting"); - } - if (this.Client.ApiVersion == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -691,25 +664,14 @@ internal CostSettingOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("costSetting", costSetting); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PatchResource", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costsettings/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", Uri.EscapeDataString(name)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (this.Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); - } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); @@ -717,7 +679,7 @@ internal CostSettingOperations(DevTestLabsClient client) // Create HTTP transport objects HttpRequestMessage _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -746,12 +708,6 @@ internal CostSettingOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; - if(costSetting != null) - { - _requestContent = SafeJsonConvert.SerializeObject(costSetting, this.Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -807,7 +763,7 @@ internal CostSettingOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -820,7 +776,7 @@ internal CostSettingOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostSettingOperationsExtensions.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostInsightOperationsExtensions.cs similarity index 51% rename from src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostSettingOperationsExtensions.cs rename to src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostInsightOperationsExtensions.cs index 98bd36c99279..fb43c53148d4 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostSettingOperationsExtensions.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostInsightOperationsExtensions.cs @@ -14,16 +14,17 @@ namespace Microsoft.Azure.Management.DevTestLabs using System.Threading; using System.Threading.Tasks; using Microsoft.Rest; + using Microsoft.Rest.Azure.OData; using Microsoft.Rest.Azure; using Models; /// - /// Extension methods for CostSettingOperations. + /// Extension methods for CostInsightOperations. /// - public static partial class CostSettingOperationsExtensions + public static partial class CostInsightOperationsExtensions { /// - /// Get cost setting. + /// List cost insights. /// /// /// The operations group for this extension method. @@ -34,16 +35,16 @@ public static partial class CostSettingOperationsExtensions /// /// The name of the lab. /// - /// - /// The name of the cost setting. + /// + /// OData parameters to apply to the operation. /// - public static CostSetting GetResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name) + public static IPage List(this ICostInsightOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return Task.Factory.StartNew(s => ((ICostSettingOperations)s).GetResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return Task.Factory.StartNew(s => ((ICostInsightOperations)s).ListAsync(resourceGroupName, labName, odataQuery), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } /// - /// Get cost setting. + /// List cost insights. /// /// /// The operations group for this extension method. @@ -54,22 +55,22 @@ public static CostSetting GetResource(this ICostSettingOperations operations, st /// /// The name of the lab. /// - /// - /// The name of the cost setting. + /// + /// OData parameters to apply to the operation. /// /// /// The cancellation token. /// - public static async Task GetResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create or replace an existing cost setting. + /// Get cost insight. /// /// /// The operations group for this extension method. @@ -81,17 +82,15 @@ public static CostSetting GetResource(this ICostSettingOperations operations, st /// The name of the lab. /// /// - /// The name of the cost setting. - /// - /// + /// The name of the cost insight. /// - public static CostSetting CreateOrUpdateResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting) + public static CostInsight GetResource(this ICostInsightOperations operations, string resourceGroupName, string labName, string name) { - return Task.Factory.StartNew(s => ((ICostSettingOperations)s).CreateOrUpdateResourceAsync(resourceGroupName, labName, name, costSetting), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return Task.Factory.StartNew(s => ((ICostInsightOperations)s).GetResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } /// - /// Create or replace an existing cost setting. + /// Get cost insight. /// /// /// The operations group for this extension method. @@ -103,23 +102,22 @@ public static CostSetting CreateOrUpdateResource(this ICostSettingOperations ope /// The name of the lab. /// /// - /// The name of the cost setting. - /// - /// + /// The name of the cost insight. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetResourceAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateResourceWithHttpMessagesAsync(resourceGroupName, labName, name, costSetting, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Delete cost setting. + /// Refresh Lab's Cost Insight Data. This operation can take a while to + /// complete. /// /// /// The operations group for this extension method. @@ -131,15 +129,16 @@ public static CostSetting CreateOrUpdateResource(this ICostSettingOperations ope /// The name of the lab. /// /// - /// The name of the cost setting. + /// The name of the cost insight. /// - public static void DeleteResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name) + public static void RefreshData(this ICostInsightOperations operations, string resourceGroupName, string labName, string name) { - Task.Factory.StartNew(s => ((ICostSettingOperations)s).DeleteResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + Task.Factory.StartNew(s => ((ICostInsightOperations)s).RefreshDataAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } /// - /// Delete cost setting. + /// Refresh Lab's Cost Insight Data. This operation can take a while to + /// complete. /// /// /// The operations group for this extension method. @@ -151,18 +150,19 @@ public static void DeleteResource(this ICostSettingOperations operations, string /// The name of the lab. /// /// - /// The name of the cost setting. + /// The name of the cost insight. /// /// /// The cancellation token. /// - public static async Task DeleteResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RefreshDataAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); + await operations.RefreshDataWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); } /// - /// Modify properties of cost settings. + /// Refresh Lab's Cost Insight Data. This operation can take a while to + /// complete. /// /// /// The operations group for this extension method. @@ -174,17 +174,16 @@ public static void DeleteResource(this ICostSettingOperations operations, string /// The name of the lab. /// /// - /// The name of the cost setting. - /// - /// + /// The name of the cost insight. /// - public static CostSetting PatchResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting) + public static void BeginRefreshData(this ICostInsightOperations operations, string resourceGroupName, string labName, string name) { - return Task.Factory.StartNew(s => ((ICostSettingOperations)s).PatchResourceAsync(resourceGroupName, labName, name, costSetting), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + Task.Factory.StartNew(s => ((ICostInsightOperations)s).BeginRefreshDataAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } /// - /// Modify properties of cost settings. + /// Refresh Lab's Cost Insight Data. This operation can take a while to + /// complete. /// /// /// The operations group for this extension method. @@ -196,16 +195,45 @@ public static CostSetting PatchResource(this ICostSettingOperations operations, /// The name of the lab. /// /// - /// The name of the cost setting. + /// The name of the cost insight. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRefreshDataAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + await operations.BeginRefreshDataWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); + } + + /// + /// List cost insights. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICostInsightOperations operations, string nextPageLink) + { + return Task.Factory.StartNew(s => ((ICostInsightOperations)s).ListNextAsync(nextPageLink), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// List cost insights. + /// + /// + /// The operations group for this extension method. /// - /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The cancellation token. /// - public static async Task PatchResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this ICostInsightOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PatchResourceWithHttpMessagesAsync(resourceGroupName, labName, name, costSetting, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperations.cs index 0ce58a587676..71c39e0fb4e8 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperations.cs @@ -244,6 +244,396 @@ internal CostOperations(DevTestLabsClient client) return _result; } + /// + /// Get cost. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (this.Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (this.Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetResource", tracingParameters); + } + // Construct URL + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + HttpRequestMessage _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Refresh Lab's Cost Data. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRefreshDataWithHttpMessagesAsync( + resourceGroupName, labName, name, customHeaders, cancellationToken); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); + } + + /// + /// Refresh Lab's Cost Data. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (this.Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (this.Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRefreshData", tracingParameters); + } + // Construct URL + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}/refreshData").ToString(); + _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + HttpRequestMessage _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// List costs. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperationsExtensions.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperationsExtensions.cs index 5136ca6812e4..0df270bb2d7c 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperationsExtensions.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/CostOperationsExtensions.cs @@ -69,6 +69,138 @@ public static partial class CostOperationsExtensions } } + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + public static Cost GetResource(this ICostOperations operations, string resourceGroupName, string labName, string name) + { + return Task.Factory.StartNew(s => ((ICostOperations)s).GetResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The cancellation token. + /// + public static async Task GetResourceAsync(this ICostOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Refresh Lab's Cost Data. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + public static void RefreshData(this ICostOperations operations, string resourceGroupName, string labName, string name) + { + Task.Factory.StartNew(s => ((ICostOperations)s).RefreshDataAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Refresh Lab's Cost Data. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The cancellation token. + /// + public static async Task RefreshDataAsync(this ICostOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + await operations.RefreshDataWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); + } + + /// + /// Refresh Lab's Cost Data. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + public static void BeginRefreshData(this ICostOperations operations, string resourceGroupName, string labName, string name) + { + Task.Factory.StartNew(s => ((ICostOperations)s).BeginRefreshDataAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Refresh Lab's Cost Data. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRefreshDataAsync(this ICostOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + await operations.BeginRefreshDataWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); + } + /// /// List costs. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/DevTestLabsClient.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/DevTestLabsClient.cs index 9284899e88e6..e9835e316672 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/DevTestLabsClient.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/DevTestLabsClient.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Management.DevTestLabs using Models; /// - /// The DevTest Labs Client. + /// The DevTest Labs client version 2015-05-21-preview. /// public partial class DevTestLabsClient : ServiceClient, IDevTestLabsClient, IAzureClient { @@ -93,14 +93,14 @@ public partial class DevTestLabsClient : ServiceClient, IDevT public virtual IArtifactOperations Artifact { get; private set; } /// - /// Gets the ICostOperations. + /// Gets the ICostInsightOperations. /// - public virtual ICostOperations Cost { get; private set; } + public virtual ICostInsightOperations CostInsight { get; private set; } /// - /// Gets the ICostSettingOperations. + /// Gets the ICostOperations. /// - public virtual ICostSettingOperations CostSetting { get; private set; } + public virtual ICostOperations Cost { get; private set; } /// /// Gets the ICustomImageOperations. @@ -132,11 +132,6 @@ public partial class DevTestLabsClient : ServiceClient, IDevT /// public virtual IScheduleOperations Schedule { get; private set; } - /// - /// Gets the IUnattendedTaskOperations. - /// - public virtual IUnattendedTaskOperations UnattendedTask { get; private set; } - /// /// Gets the IVirtualMachineOperations. /// @@ -329,15 +324,14 @@ private void Initialize() this.Lab = new LabOperations(this); this.ArtifactSource = new ArtifactSourceOperations(this); this.Artifact = new ArtifactOperations(this); + this.CostInsight = new CostInsightOperations(this); this.Cost = new CostOperations(this); - this.CostSetting = new CostSettingOperations(this); this.CustomImage = new CustomImageOperations(this); this.Formula = new FormulaOperations(this); this.GalleryImage = new GalleryImageOperations(this); this.PolicySet = new PolicySetOperations(this); this.Policy = new PolicyOperations(this); this.Schedule = new ScheduleOperations(this); - this.UnattendedTask = new UnattendedTaskOperations(this); this.VirtualMachine = new VirtualMachineOperations(this); this.VirtualNetwork = new VirtualNetworkOperations(this); this.BaseUri = new Uri("https://management.azure.com"); diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostSettingOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostInsightOperations.cs similarity index 57% rename from src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostSettingOperations.cs rename to src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostInsightOperations.cs index 93317352a40d..badcf2074e74 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostSettingOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostInsightOperations.cs @@ -14,16 +14,17 @@ namespace Microsoft.Azure.Management.DevTestLabs using System.Threading; using System.Threading.Tasks; using Microsoft.Rest; + using Microsoft.Rest.Azure.OData; using Microsoft.Rest.Azure; using Models; /// - /// CostSettingOperations operations. + /// CostInsightOperations operations. /// - public partial interface ICostSettingOperations + public partial interface ICostInsightOperations { /// - /// Get cost setting. + /// List cost insights. /// /// /// The name of the resource group. @@ -31,8 +32,8 @@ public partial interface ICostSettingOperations /// /// The name of the lab. /// - /// - /// The name of the cost setting. + /// + /// OData parameters to apply to the operation. /// /// /// The headers that will be added to request. @@ -40,9 +41,9 @@ public partial interface ICostSettingOperations /// /// The cancellation token. /// - Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or replace an existing cost setting. + /// Get cost insight. /// /// /// The name of the resource group. @@ -51,9 +52,7 @@ public partial interface ICostSettingOperations /// The name of the lab. /// /// - /// The name of the cost setting. - /// - /// + /// The name of the cost insight. /// /// /// The headers that will be added to request. @@ -61,9 +60,10 @@ public partial interface ICostSettingOperations /// /// The cancellation token. /// - Task> CreateOrUpdateResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CostSetting costSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete cost setting. + /// Refresh Lab's Cost Insight Data. This operation can take a while + /// to complete. /// /// /// The name of the resource group. @@ -72,7 +72,7 @@ public partial interface ICostSettingOperations /// The name of the lab. /// /// - /// The name of the cost setting. + /// The name of the cost insight. /// /// /// The headers that will be added to request. @@ -80,9 +80,10 @@ public partial interface ICostSettingOperations /// /// The cancellation token. /// - Task DeleteResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Modify properties of cost settings. + /// Refresh Lab's Cost Insight Data. This operation can take a while + /// to complete. /// /// /// The name of the resource group. @@ -91,9 +92,20 @@ public partial interface ICostSettingOperations /// The name of the lab. /// /// - /// The name of the cost setting. + /// The name of the cost insight. + /// + /// + /// The headers that will be added to request. /// - /// + /// + /// The cancellation token. + /// + Task BeginRefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List cost insights. + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -101,6 +113,6 @@ public partial interface ICostSettingOperations /// /// The cancellation token. /// - Task> PatchResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CostSetting costSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostOperations.cs index 4012981664a5..93532857dffe 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ICostOperations.cs @@ -43,6 +43,65 @@ public partial interface ICostOperations /// Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Get cost. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Refresh Lab's Cost Data. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task RefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Refresh Lab's Cost Data. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task BeginRefreshDataWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// List costs. /// /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IDevTestLabsClient.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IDevTestLabsClient.cs index d1309c21b1e2..56a53064456b 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IDevTestLabsClient.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IDevTestLabsClient.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Management.DevTestLabs using Models; /// - /// The DevTest Labs Client. + /// The DevTest Labs client version 2015-05-21-preview. /// public partial interface IDevTestLabsClient : IDisposable { @@ -87,14 +87,14 @@ public partial interface IDevTestLabsClient : IDisposable IArtifactOperations Artifact { get; } /// - /// Gets the ICostOperations. + /// Gets the ICostInsightOperations. /// - ICostOperations Cost { get; } + ICostInsightOperations CostInsight { get; } /// - /// Gets the ICostSettingOperations. + /// Gets the ICostOperations. /// - ICostSettingOperations CostSetting { get; } + ICostOperations Cost { get; } /// /// Gets the ICustomImageOperations. @@ -126,11 +126,6 @@ public partial interface IDevTestLabsClient : IDisposable /// IScheduleOperations Schedule { get; } - /// - /// Gets the IUnattendedTaskOperations. - /// - IUnattendedTaskOperations UnattendedTask { get; } - /// /// Gets the IVirtualMachineOperations. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ILabOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ILabOperations.cs index 6d89206f9067..549860dedc75 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ILabOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ILabOperations.cs @@ -211,7 +211,7 @@ public partial interface ILabOperations /// /// The cancellation token. /// - Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List disk images available for custom image creation. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IPolicySetOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IPolicySetOperations.cs index 386d3664cf15..2f1676d1b874 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IPolicySetOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IPolicySetOperations.cs @@ -34,7 +34,7 @@ public partial interface IPolicySetOperations /// /// The name of the policy set. /// - /// + /// /// /// /// The headers that will be added to request. @@ -42,6 +42,6 @@ public partial interface IPolicySetOperations /// /// The cancellation token. /// - Task>> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, IList listOfevaluatePoliciesProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IScheduleOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IScheduleOperations.cs index f1cd4bf6e00e..db672fa80c65 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IScheduleOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IScheduleOperations.cs @@ -165,6 +165,44 @@ public partial interface IScheduleOperations /// Task> PatchResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// List schedules. /// /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IUnattendedTaskOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IUnattendedTaskOperations.cs deleted file mode 100644 index 01179d8d7d5d..000000000000 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IUnattendedTaskOperations.cs +++ /dev/null @@ -1,202 +0,0 @@ -// 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 0.16.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.DevTestLabs -{ - using System; - using System.Collections.Generic; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Rest; - using Microsoft.Rest.Azure.OData; - using Microsoft.Rest.Azure; - using Models; - - /// - /// UnattendedTaskOperations operations. - /// - public partial interface IUnattendedTaskOperations - { - /// - /// List unattended tasks. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get unattended task. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing unattended task. This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task> CreateOrUpdateResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing unattended task. This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task> BeginCreateOrUpdateResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete unattended task. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task DeleteResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of unattended tasks. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task> PatchResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Execute an unattended task. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Execute an unattended task. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List unattended tasks. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IVirtualMachineOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IVirtualMachineOperations.cs index 478df8b8a908..ae85e175f7cd 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IVirtualMachineOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/IVirtualMachineOperations.cs @@ -179,7 +179,7 @@ public partial interface IVirtualMachineOperations /// /// The name of the virtual Machine. /// - /// + /// /// /// /// The headers that will be added to request. @@ -187,7 +187,7 @@ public partial interface IVirtualMachineOperations /// /// The cancellation token. /// - Task ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Apply artifacts to Lab VM. This operation can take a while to /// complete. @@ -201,7 +201,7 @@ public partial interface IVirtualMachineOperations /// /// The name of the virtual Machine. /// - /// + /// /// /// /// The headers that will be added to request. @@ -209,7 +209,7 @@ public partial interface IVirtualMachineOperations /// /// The cancellation token. /// - Task BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Start a Lab VM. This operation can take a while to complete. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperations.cs index c9fa63c8a937..316b2a295166 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperations.cs @@ -1441,7 +1441,7 @@ internal LabOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (this.Client.SubscriptionId == null) { @@ -1584,7 +1584,7 @@ internal LabOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1597,7 +1597,7 @@ internal LabOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperationsExtensions.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperationsExtensions.cs index 0f88b8824a96..504e1f20163f 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperationsExtensions.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/LabOperationsExtensions.cs @@ -447,7 +447,7 @@ public static void BeginCreateEnvironment(this ILabOperations operations, string /// /// /// - public static string GenerateUploadUri(this ILabOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter) + public static GenerateUploadUriResponse GenerateUploadUri(this ILabOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter) { return Task.Factory.StartNew(s => ((ILabOperations)s).GenerateUploadUriAsync(resourceGroupName, name, generateUploadUriParameter), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } @@ -469,7 +469,7 @@ public static string GenerateUploadUri(this ILabOperations operations, string re /// /// The cancellation token. /// - public static async Task GenerateUploadUriAsync(this ILabOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GenerateUploadUriAsync(this ILabOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GenerateUploadUriWithHttpMessagesAsync(resourceGroupName, name, generateUploadUriParameter, null, cancellationToken).ConfigureAwait(false)) { diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ApplyArtifactsRequest.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ApplyArtifactsRequest.cs new file mode 100644 index 000000000000..1be61c39dcb1 --- /dev/null +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ApplyArtifactsRequest.cs @@ -0,0 +1,44 @@ +// 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 0.16.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System; + using System.Linq; + using System.Collections.Generic; + using Newtonsoft.Json; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Microsoft.Rest.Azure; + + /// + /// Request body for applying artifacts to a virtual machine. + /// + public partial class ApplyArtifactsRequest + { + /// + /// Initializes a new instance of the ApplyArtifactsRequest class. + /// + public ApplyArtifactsRequest() { } + + /// + /// Initializes a new instance of the ApplyArtifactsRequest class. + /// + public ApplyArtifactsRequest(IList artifacts = default(IList)) + { + Artifacts = artifacts; + } + + /// + /// The list of artifacts to apply. + /// + [JsonProperty(PropertyName = "artifacts")] + public IList Artifacts { get; set; } + + } +} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArmTemplateInfo.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArmTemplateInfo.cs index d003dedf33cc..9165a7db45d4 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArmTemplateInfo.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArmTemplateInfo.cs @@ -16,6 +16,9 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Serialization; using Microsoft.Rest.Azure; + /// + /// Information about a generated ARM template. + /// public partial class ArmTemplateInfo { /// @@ -26,21 +29,23 @@ public ArmTemplateInfo() { } /// /// Initializes a new instance of the ArmTemplateInfo class. /// - public ArmTemplateInfo(string template = default(string), string parameters = default(string)) + public ArmTemplateInfo(object template = default(object), object parameters = default(object)) { Template = template; Parameters = parameters; } /// + /// The template's contents. /// [JsonProperty(PropertyName = "template")] - public string Template { get; set; } + public object Template { get; set; } /// + /// The parameters of the ARM template. /// [JsonProperty(PropertyName = "parameters")] - public string Parameters { get; set; } + public object Parameters { get; set; } } } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Artifact.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Artifact.cs index c05e8fde4d90..6c4383330e5c 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Artifact.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Artifact.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// An artifact. /// [JsonTransformation] public partial class Artifact : IResource diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArtifactSource.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArtifactSource.cs index 84ff7eaf408b..95590f47ea2e 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArtifactSource.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/ArtifactSource.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// Properties of an artifact source. /// [JsonTransformation] public partial class ArtifactSource : IResource diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Cost.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Cost.cs index bead103fcea7..0b73502c8be3 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Cost.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Cost.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A cost item. /// [JsonTransformation] public partial class Cost : IResource @@ -30,11 +30,10 @@ public Cost() { } /// /// Initializes a new instance of the Cost class. /// - public Cost(string currencyCode = default(string), IList costs = default(IList), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public Cost(string currencyCode = default(string), IList costs = default(IList), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { CurrencyCode = currencyCode; Costs = costs; - ProvisioningState = provisioningState; Id = id; Name = name; Type = type; @@ -54,12 +53,6 @@ public Cost() { } [JsonProperty(PropertyName = "properties.costs")] public IList Costs { get; set; } - /// - /// The provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - /// /// The identifier of the resource. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostSetting.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostInsight.cs similarity index 66% rename from src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostSetting.cs rename to src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostInsight.cs index 5b142d2b4141..edd49ea3f3a1 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostSetting.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostInsight.cs @@ -16,24 +16,21 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Serialization; using Microsoft.Rest.Azure; - /// - /// An Azure resource. - /// [JsonTransformation] - public partial class CostSetting : IResource + public partial class CostInsight : IResource { /// - /// Initializes a new instance of the CostSetting class. + /// Initializes a new instance of the CostInsight class. /// - public CostSetting() { } + public CostInsight() { } /// - /// Initializes a new instance of the CostSetting class. + /// Initializes a new instance of the CostInsight class. /// - public CostSetting(string startDayType = default(string), string startDay = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public CostInsight(string currencyCode = default(string), IList vmCosts = default(IList), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { - StartDayType = startDayType; - StartDay = startDay; + CurrencyCode = currencyCode; + VmCosts = vmCosts; ProvisioningState = provisioningState; Id = id; Name = name; @@ -43,17 +40,14 @@ public CostSetting() { } } /// - /// The start day type of the cost setting. Possible values include: - /// 'CalendarDate', 'LabCreationDate' /// - [JsonProperty(PropertyName = "properties.startDayType")] - public string StartDayType { get; set; } + [JsonProperty(PropertyName = "properties.currencyCode")] + public string CurrencyCode { get; set; } /// - /// The start day of the cost setting. /// - [JsonProperty(PropertyName = "properties.startDay")] - public string StartDay { get; set; } + [JsonProperty(PropertyName = "properties.vmCosts")] + public IList VmCosts { get; set; } /// /// The provisioning status of the resource. diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostPerDayProperties.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostPerDayProperties.cs index 86055f5219ad..c9166cc41b42 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostPerDayProperties.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostPerDayProperties.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// The per-day properties of a cost. + /// The per-day properties of a cost item. /// public partial class CostPerDayProperties { diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CustomImage.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CustomImage.cs index 457edcaaefde..e52bb87ac349 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CustomImage.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CustomImage.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A custom image. /// [JsonTransformation] public partial class CustomImage : IResource diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/DayDetails.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/DayDetails.cs index 8da3ee9d9c01..7b06d44febab 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/DayDetails.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/DayDetails.cs @@ -29,7 +29,7 @@ public DayDetails() { } /// /// Initializes a new instance of the DayDetails class. /// - public DayDetails(Recurrence time = default(Recurrence)) + public DayDetails(string time = default(string)) { Time = time; } @@ -37,7 +37,7 @@ public DayDetails() { } /// /// [JsonProperty(PropertyName = "time")] - public Recurrence Time { get; set; } + public string Time { get; set; } } } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/EvaluatePoliciesRequest.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/EvaluatePoliciesRequest.cs new file mode 100644 index 000000000000..ea8dad020d50 --- /dev/null +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/EvaluatePoliciesRequest.cs @@ -0,0 +1,44 @@ +// 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 0.16.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System; + using System.Linq; + using System.Collections.Generic; + using Newtonsoft.Json; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Microsoft.Rest.Azure; + + /// + /// Request body for evaluating a policy set. + /// + public partial class EvaluatePoliciesRequest + { + /// + /// Initializes a new instance of the EvaluatePoliciesRequest class. + /// + public EvaluatePoliciesRequest() { } + + /// + /// Initializes a new instance of the EvaluatePoliciesRequest class. + /// + public EvaluatePoliciesRequest(IList policies = default(IList)) + { + Policies = policies; + } + + /// + /// Policies to evaluate. + /// + [JsonProperty(PropertyName = "policies")] + public IList Policies { get; set; } + + } +} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/EvaluatePoliciesResponse.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/EvaluatePoliciesResponse.cs new file mode 100644 index 000000000000..15439503b6e1 --- /dev/null +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/EvaluatePoliciesResponse.cs @@ -0,0 +1,44 @@ +// 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 0.16.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System; + using System.Linq; + using System.Collections.Generic; + using Newtonsoft.Json; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Microsoft.Rest.Azure; + + /// + /// Response body for evaluating a policy set. + /// + public partial class EvaluatePoliciesResponse + { + /// + /// Initializes a new instance of the EvaluatePoliciesResponse class. + /// + public EvaluatePoliciesResponse() { } + + /// + /// Initializes a new instance of the EvaluatePoliciesResponse class. + /// + public EvaluatePoliciesResponse(IList results = default(IList)) + { + Results = results; + } + + /// + /// Results of evaluating a policy set. + /// + [JsonProperty(PropertyName = "results")] + public IList Results { get; set; } + + } +} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Formula.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Formula.cs index 885f9d598ea8..8d0d7cdd235d 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Formula.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Formula.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A formula. /// [JsonTransformation] public partial class Formula : IResource @@ -30,7 +30,7 @@ public Formula() { } /// /// Initializes a new instance of the Formula class. /// - public Formula(string description = default(string), string author = default(string), string osType = default(string), DateTime? creationDate = default(DateTime?), object formulaContent = default(object), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public Formula(string description = default(string), string author = default(string), string osType = default(string), DateTime? creationDate = default(DateTime?), LabVirtualMachine formulaContent = default(LabVirtualMachine), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Description = description; Author = author; @@ -74,7 +74,7 @@ public Formula() { } /// The content of the formula. /// [JsonProperty(PropertyName = "properties.formulaContent")] - public object FormulaContent { get; set; } + public LabVirtualMachine FormulaContent { get; set; } /// /// Information about a VM from which a formula is to be created. diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GalleryImage.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GalleryImage.cs index 23d846ead1e0..239dd2b7e066 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GalleryImage.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GalleryImage.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A gallery image. /// [JsonTransformation] public partial class GalleryImage : IResource @@ -30,7 +30,7 @@ public GalleryImage() { } /// /// Initializes a new instance of the GalleryImage class. /// - public GalleryImage(string author = default(string), DateTime? createdDate = default(DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public GalleryImage(string author = default(string), DateTime? createdDate = default(DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Author = author; CreatedDate = createdDate; @@ -38,7 +38,6 @@ public GalleryImage() { } ImageReference = imageReference; Icon = icon; Enabled = enabled; - ProvisioningState = provisioningState; Id = id; Name = name; Type = type; @@ -82,12 +81,6 @@ public GalleryImage() { } [JsonProperty(PropertyName = "properties.enabled")] public bool? Enabled { get; set; } - /// - /// The provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - /// /// The identifier of the resource. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GenerateArmTemplateRequest.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GenerateArmTemplateRequest.cs index 2cc82bde8c7e..8a7050a92456 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GenerateArmTemplateRequest.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GenerateArmTemplateRequest.cs @@ -16,6 +16,9 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Serialization; using Microsoft.Rest.Azure; + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// public partial class GenerateArmTemplateRequest { /// @@ -34,17 +37,19 @@ public GenerateArmTemplateRequest() { } } /// - /// The resource name of the virtual machine + /// The resource name of the virtual machine. /// [JsonProperty(PropertyName = "virtualMachineName")] public string VirtualMachineName { get; set; } /// + /// The parameters of the ARM template. /// [JsonProperty(PropertyName = "parameters")] public IList Parameters { get; set; } /// + /// The location of the virtual machine. /// [JsonProperty(PropertyName = "location")] public string Location { get; set; } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GenerateUploadUriResponse.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GenerateUploadUriResponse.cs new file mode 100644 index 000000000000..2524f04eb6c4 --- /dev/null +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/GenerateUploadUriResponse.cs @@ -0,0 +1,44 @@ +// 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 0.16.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System; + using System.Linq; + using System.Collections.Generic; + using Newtonsoft.Json; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Microsoft.Rest.Azure; + + /// + /// Reponse body for generating an upload URI. + /// + public partial class GenerateUploadUriResponse + { + /// + /// Initializes a new instance of the GenerateUploadUriResponse class. + /// + public GenerateUploadUriResponse() { } + + /// + /// Initializes a new instance of the GenerateUploadUriResponse class. + /// + public GenerateUploadUriResponse(string uploadUri = default(string)) + { + UploadUri = uploadUri; + } + + /// + /// The upload URI for the VHD. + /// + [JsonProperty(PropertyName = "uploadUri")] + public string UploadUri { get; set; } + + } +} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/HourDetails.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/HourDetails.cs index 18f7575ac70b..0bd405aaccaf 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/HourDetails.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/HourDetails.cs @@ -35,6 +35,7 @@ public HourDetails() { } } /// + /// Minutes of the hour the schedule will run. /// [JsonProperty(PropertyName = "minute")] public int? Minute { get; set; } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Lab.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Lab.cs index 92df8ee0a4d7..b907c5139d1b 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Lab.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Lab.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A lab. /// [JsonTransformation] public partial class Lab : IResource diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/LabVirtualMachine.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/LabVirtualMachine.cs index 746f702c9b73..2996a6c5859a 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/LabVirtualMachine.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/LabVirtualMachine.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A virtual machine. /// [JsonTransformation] public partial class LabVirtualMachine : IResource @@ -30,10 +30,12 @@ public LabVirtualMachine() { } /// /// Initializes a new instance of the LabVirtualMachine class. /// - public LabVirtualMachine(string notes = default(string), string ownerObjectId = default(string), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), string builtInPassword = default(string), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public LabVirtualMachine(string notes = default(string), string ownerObjectId = default(string), string createdByUserId = default(string), string createdByUser = default(string), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Notes = notes; OwnerObjectId = ownerObjectId; + CreatedByUserId = createdByUserId; + CreatedByUser = createdByUser; ComputeId = computeId; CustomImageId = customImageId; OsType = osType; @@ -46,7 +48,6 @@ public LabVirtualMachine() { } LabSubnetName = labSubnetName; LabVirtualNetworkId = labVirtualNetworkId; DisallowPublicIpAddress = disallowPublicIpAddress; - BuiltInPassword = builtInPassword; Artifacts = artifacts; ArtifactDeploymentStatus = artifactDeploymentStatus; GalleryImageReference = galleryImageReference; @@ -71,7 +72,19 @@ public LabVirtualMachine() { } public string OwnerObjectId { get; set; } /// - /// The resource identifier (Microsof.Compute) of the virtual machine. + /// The object identifier of the creator of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId { get; set; } + + /// + /// The email address of creator of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser { get; set; } + + /// + /// The resource identifier (Microsoft.Compute) of the virtual machine. /// [JsonProperty(PropertyName = "properties.computeId")] public string ComputeId { get; set; } @@ -144,12 +157,6 @@ public LabVirtualMachine() { } [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] public bool? DisallowPublicIpAddress { get; set; } - /// - /// The built-in admin password of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.builtInPassword")] - public string BuiltInPassword { get; set; } - /// /// The artifacts to be installed on the virtual machine. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Policy.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Policy.cs index 53b11be91fb9..80e54808376b 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Policy.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Policy.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A Policy. /// [JsonTransformation] public partial class Policy : IResource @@ -30,14 +30,14 @@ public Policy() { } /// /// Initializes a new instance of the Policy class. /// - public Policy(string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string policyEvaluatorType = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public Policy(string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Description = description; Status = status; FactName = factName; FactData = factData; Threshold = threshold; - PolicyEvaluatorType = policyEvaluatorType; + EvaluatorType = evaluatorType; ProvisioningState = provisioningState; Id = id; Name = name; @@ -60,7 +60,9 @@ public Policy() { } public string Status { get; set; } /// - /// The fact name of the policy. + /// The fact name of the policy. Possible values include: + /// 'UserOwnedLabVmCount', 'LabVmCount', 'LabVmSize', 'GalleryImage', + /// 'UserOwnedLabVmCountInSubnet' /// [JsonProperty(PropertyName = "properties.factName")] public string FactName { get; set; } @@ -78,10 +80,11 @@ public Policy() { } public string Threshold { get; set; } /// - /// The evaluator type of the policy. + /// The evaluator type of the policy. Possible values include: + /// 'AllowedValuesPolicy', 'MaxValuePolicy' /// - [JsonProperty(PropertyName = "properties.policyEvaluatorType")] - public string PolicyEvaluatorType { get; set; } + [JsonProperty(PropertyName = "properties.evaluatorType")] + public string EvaluatorType { get; set; } /// /// The provisioning status of the resource. diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostStartDayType.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/PolicyEvaluatorType.cs similarity index 70% rename from src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostStartDayType.cs rename to src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/PolicyEvaluatorType.cs index fb9082ba0adf..f84c87c27353 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/CostStartDayType.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/PolicyEvaluatorType.cs @@ -13,11 +13,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using System.Runtime.Serialization; /// - /// Defines values for CostStartDayType. + /// Defines values for PolicyEvaluatorType. /// - public static class CostStartDayType + public static class PolicyEvaluatorType { - public const string CalendarDate = "CalendarDate"; - public const string LabCreationDate = "LabCreationDate"; + public const string AllowedValuesPolicy = "AllowedValuesPolicy"; + public const string MaxValuePolicy = "MaxValuePolicy"; } } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/PolicyFactName.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/PolicyFactName.cs new file mode 100644 index 000000000000..64910dd08911 --- /dev/null +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/PolicyFactName.cs @@ -0,0 +1,26 @@ +// 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 0.16.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime.Serialization; + + /// + /// Defines values for PolicyFactName. + /// + public static class PolicyFactName + { + public const string UserOwnedLabVmCount = "UserOwnedLabVmCount"; + public const string LabVmCount = "LabVmCount"; + public const string LabVmSize = "LabVmSize"; + public const string GalleryImage = "GalleryImage"; + public const string UserOwnedLabVmCountInSubnet = "UserOwnedLabVmCountInSubnet"; + } +} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Schedule.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Schedule.cs index 636cbbd0a8ac..4fe54b536821 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Schedule.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Schedule.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A schedule. /// [JsonTransformation] public partial class Schedule : IResource @@ -30,13 +30,14 @@ public Schedule() { } /// /// Initializes a new instance of the Schedule class. /// - public Schedule(string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public Schedule(string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Status = status; TaskType = taskType; WeeklyRecurrence = weeklyRecurrence; DailyRecurrence = dailyRecurrence; HourlyRecurrence = hourlyRecurrence; + TimeZoneId = timeZoneId; ProvisioningState = provisioningState; Id = id; Name = name; @@ -53,7 +54,8 @@ public Schedule() { } public string Status { get; set; } /// - /// The task type of the schedule. + /// The task type of the schedule. Possible values include: + /// 'LabVmsShutdownTask', 'LabVmsStartupTask', 'LabBillingTask' /// [JsonProperty(PropertyName = "properties.taskType")] public string TaskType { get; set; } @@ -76,6 +78,12 @@ public Schedule() { } [JsonProperty(PropertyName = "properties.hourlyRecurrence")] public HourDetails HourlyRecurrence { get; set; } + /// + /// The time zone id. + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; set; } + /// /// The provisioning status of the resource. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/SubnetOverride.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/SubnetOverride.cs index 3a76af27024b..333316a5904b 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/SubnetOverride.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/SubnetOverride.cs @@ -44,13 +44,13 @@ public SubnetOverride() { } public string ResourceId { get; set; } /// - /// The lab subnet name of the subnet. + /// The name given to the subnet within the lab. /// [JsonProperty(PropertyName = "labSubnetName")] public string LabSubnetName { get; set; } /// - /// Indicates whether this subnet can be during virtual machine + /// Indicates whether this subnet can be used during virtual machine /// creation. Possible values include: 'Default', 'Deny', 'Allow' /// [JsonProperty(PropertyName = "useInVmCreationPermission")] diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/UnattendedTask.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/UnattendedTask.cs deleted file mode 100644 index 4e4a98bffcef..000000000000 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/UnattendedTask.cs +++ /dev/null @@ -1,95 +0,0 @@ -// 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 0.16.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using System; - using System.Linq; - using System.Collections.Generic; - using Newtonsoft.Json; - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Microsoft.Rest.Azure; - - /// - /// An Azure resource. - /// - [JsonTransformation] - public partial class UnattendedTask : IResource - { - /// - /// Initializes a new instance of the UnattendedTask class. - /// - public UnattendedTask() { } - - /// - /// Initializes a new instance of the UnattendedTask class. - /// - public UnattendedTask(string arguments = default(string), string taskType = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) - { - Arguments = arguments; - TaskType = taskType; - ProvisioningState = provisioningState; - Id = id; - Name = name; - Type = type; - Location = location; - Tags = tags; - } - - /// - /// The arguments of the unattended task. - /// - [JsonProperty(PropertyName = "properties.arguments")] - public string Arguments { get; set; } - - /// - /// The type of the unattended task. Possible values include: - /// 'LabVmsShutdownTask', 'LabVmsStartupTask', 'LabBillingTask' - /// - [JsonProperty(PropertyName = "properties.taskType")] - public string TaskType { get; set; } - - /// - /// The provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// The identifier of the resource. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// The name of the resource. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// The type of the resource. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// The location of the resource. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// The tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - } -} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Recurrence.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/VMCostProperties.cs similarity index 53% rename from src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Recurrence.cs rename to src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/VMCostProperties.cs index 062098be028d..132b06cea169 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/Recurrence.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/VMCostProperties.cs @@ -16,40 +16,37 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Serialization; using Microsoft.Rest.Azure; - /// - /// Daily recurrence. - /// - public partial class Recurrence + public partial class VMCostProperties { /// - /// Initializes a new instance of the Recurrence class. + /// Initializes a new instance of the VMCostProperties class. /// - public Recurrence() { } + public VMCostProperties() { } /// - /// Initializes a new instance of the Recurrence class. + /// Initializes a new instance of the VMCostProperties class. /// - public Recurrence(string timeZone = default(string), int? hour = default(int?), int? minute = default(int?)) + public VMCostProperties(string name = default(string), string resourceGroupName = default(string), double? cost = default(double?)) { - TimeZone = timeZone; - Hour = hour; - Minute = minute; + Name = name; + ResourceGroupName = resourceGroupName; + Cost = cost; } /// /// - [JsonProperty(PropertyName = "timeZone")] - public string TimeZone { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } /// /// - [JsonProperty(PropertyName = "hour")] - public int? Hour { get; set; } + [JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName { get; set; } /// /// - [JsonProperty(PropertyName = "minute")] - public int? Minute { get; set; } + [JsonProperty(PropertyName = "cost")] + public double? Cost { get; set; } } } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/VirtualNetwork.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/VirtualNetwork.cs index 3e1f070d9417..86ca27e29e07 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/VirtualNetwork.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/VirtualNetwork.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models using Microsoft.Rest.Azure; /// - /// An Azure resource. + /// A virtual network. /// [JsonTransformation] public partial class VirtualNetwork : IResource @@ -30,11 +30,9 @@ public VirtualNetwork() { } /// /// Initializes a new instance of the VirtualNetwork class. /// - public VirtualNetwork(IList allowedSubnets = default(IList), string defaultUseInVmCreationPermission = default(string), string defaultUsePublicIpAddressPermission = default(string), string description = default(string), string externalProviderResourceId = default(string), IList subnetOverrides = default(IList), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public VirtualNetwork(IList allowedSubnets = default(IList), string description = default(string), string externalProviderResourceId = default(string), IList subnetOverrides = default(IList), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { AllowedSubnets = allowedSubnets; - DefaultUseInVmCreationPermission = defaultUseInVmCreationPermission; - DefaultUsePublicIpAddressPermission = defaultUsePublicIpAddressPermission; Description = description; ExternalProviderResourceId = externalProviderResourceId; SubnetOverrides = subnetOverrides; @@ -52,22 +50,6 @@ public VirtualNetwork() { } [JsonProperty(PropertyName = "properties.allowedSubnets")] public IList AllowedSubnets { get; set; } - /// - /// Indicates whether this virtual network can be during virtual - /// machine creation. Possible values include: 'Default', 'Deny', - /// 'Allow' - /// - [JsonProperty(PropertyName = "properties.defaultUseInVmCreationPermission")] - public string DefaultUseInVmCreationPermission { get; set; } - - /// - /// Indicates whether public IP addresses can be assigned to virtual - /// machines on this network. Possible values include: 'Default', - /// 'Deny', 'Allow' - /// - [JsonProperty(PropertyName = "properties.defaultUsePublicIpAddressPermission")] - public string DefaultUsePublicIpAddressPermission { get; set; } - /// /// The description of the virtual network. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/WeekDetails.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/WeekDetails.cs index ad56ac543153..c9d315e79537 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/WeekDetails.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/Models/WeekDetails.cs @@ -29,7 +29,7 @@ public WeekDetails() { } /// /// Initializes a new instance of the WeekDetails class. /// - public WeekDetails(IList weekdays = default(IList), Recurrence time = default(Recurrence)) + public WeekDetails(IList weekdays = default(IList), string time = default(string)) { Weekdays = weekdays; Time = time; @@ -45,7 +45,7 @@ public WeekDetails() { } /// The time of the day. /// [JsonProperty(PropertyName = "time")] - public Recurrence Time { get; set; } + public string Time { get; set; } } } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperations.cs index 97f9321fab9e..569b8a3aab2f 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperations.cs @@ -61,7 +61,7 @@ internal PolicySetOperations(DevTestLabsClient client) /// /// The name of the policy set. /// - /// + /// /// /// /// Headers that will be added to request. @@ -72,7 +72,7 @@ internal PolicySetOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, IList listOfevaluatePoliciesProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (this.Client.SubscriptionId == null) { @@ -90,9 +90,9 @@ internal PolicySetOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (listOfevaluatePoliciesProperties == null) + if (evaluatePoliciesRequest == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "listOfevaluatePoliciesProperties"); + throw new ValidationException(ValidationRules.CannotBeNull, "evaluatePoliciesRequest"); } if (this.Client.ApiVersion == null) { @@ -108,7 +108,7 @@ internal PolicySetOperations(DevTestLabsClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); - tracingParameters.Add("listOfevaluatePoliciesProperties", listOfevaluatePoliciesProperties); + tracingParameters.Add("evaluatePoliciesRequest", evaluatePoliciesRequest); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "EvaluatePolicies", tracingParameters); } @@ -160,9 +160,9 @@ internal PolicySetOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; - if(listOfevaluatePoliciesProperties != null) + if(evaluatePoliciesRequest != null) { - _requestContent = SafeJsonConvert.SerializeObject(listOfevaluatePoliciesProperties, this.Client.SerializationSettings); + _requestContent = SafeJsonConvert.SerializeObject(evaluatePoliciesRequest, this.Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8); _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } @@ -221,7 +221,7 @@ internal PolicySetOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -234,7 +234,7 @@ internal PolicySetOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperationsExtensions.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperationsExtensions.cs index 8e2d47822772..b6b8ef3ed5d0 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperationsExtensions.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/PolicySetOperationsExtensions.cs @@ -37,11 +37,11 @@ public static partial class PolicySetOperationsExtensions /// /// The name of the policy set. /// - /// + /// /// - public static IList EvaluatePolicies(this IPolicySetOperations operations, string resourceGroupName, string labName, string name, IList listOfevaluatePoliciesProperties) + public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetOperations operations, string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest) { - return Task.Factory.StartNew(s => ((IPolicySetOperations)s).EvaluatePoliciesAsync(resourceGroupName, labName, name, listOfevaluatePoliciesProperties), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return Task.Factory.StartNew(s => ((IPolicySetOperations)s).EvaluatePoliciesAsync(resourceGroupName, labName, name, evaluatePoliciesRequest), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } /// @@ -59,14 +59,14 @@ public static IList EvaluatePolicies(this IPolicySetOperations /// /// The name of the policy set. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task> EvaluatePoliciesAsync(this IPolicySetOperations operations, string resourceGroupName, string labName, string name, IList listOfevaluatePoliciesProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task EvaluatePoliciesAsync(this IPolicySetOperations operations, string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(resourceGroupName, labName, name, listOfevaluatePoliciesProperties, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(resourceGroupName, labName, name, evaluatePoliciesRequest, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperations.cs index c04bf63902b6..2d10ca8e2e62 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperations.cs @@ -1092,6 +1092,205 @@ internal ScheduleOperations(DevTestLabsClient client) return _result; } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync( + resourceGroupName, labName, name, customHeaders, cancellationToken); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (this.Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (this.Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); + } + // Construct URL + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + HttpRequestMessage _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// List schedules. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperationsExtensions.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperationsExtensions.cs index 87f65e64889c..9ccdfa0e3b38 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperationsExtensions.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/ScheduleOperationsExtensions.cs @@ -355,6 +355,92 @@ public static Schedule PatchResource(this IScheduleOperations operations, string } } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IScheduleOperations operations, string resourceGroupName, string labName, string name) + { + Task.Factory.StartNew(s => ((IScheduleOperations)s).ExecuteAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this IScheduleOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IScheduleOperations operations, string resourceGroupName, string labName, string name) + { + Task.Factory.StartNew(s => ((IScheduleOperations)s).BeginExecuteAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExecuteAsync(this IScheduleOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); + } + /// /// List schedules. /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/UnattendedTaskOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/UnattendedTaskOperations.cs deleted file mode 100644 index e4100c536567..000000000000 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/UnattendedTaskOperations.cs +++ /dev/null @@ -1,1428 +0,0 @@ -// 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 0.16.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.DevTestLabs -{ - using System; - using System.Linq; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Net.Http.Headers; - using System.Text; - using System.Text.RegularExpressions; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using Microsoft.Rest.Azure.OData; - using Microsoft.Rest.Azure; - using Models; - - /// - /// UnattendedTaskOperations operations. - /// - internal partial class UnattendedTaskOperations : IServiceOperations, IUnattendedTaskOperations - { - /// - /// Initializes a new instance of the UnattendedTaskOperations class. - /// - /// - /// Reference to the service client. - /// - internal UnattendedTaskOperations(DevTestLabsClient client) - { - if (client == null) - { - throw new ArgumentNullException("client"); - } - this.Client = client; - } - - /// - /// Gets a reference to the DevTestLabsClient - /// - public DevTestLabsClient Client { get; private set; } - - /// - /// List unattended tasks. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (this.Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (this.Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/unattendedtasks").ToString(); - _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (this.Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - HttpRequestMessage _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); - } - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get unattended task. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (this.Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (this.Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetResource", tracingParameters); - } - // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/unattendedtasks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (this.Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - HttpRequestMessage _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); - } - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create or replace an existing unattended task. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateResourceWithHttpMessagesAsync( - resourceGroupName, labName, name, unattendedTask, customHeaders, cancellationToken); - return await this.Client.GetPutOrPatchOperationResultAsync(_response, - customHeaders, - cancellationToken); - } - - /// - /// Create or replace an existing unattended task. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> BeginCreateOrUpdateResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (this.Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (unattendedTask == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "unattendedTask"); - } - if (this.Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("unattendedTask", unattendedTask); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateResource", tracingParameters); - } - // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/unattendedtasks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (this.Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - HttpRequestMessage _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); - } - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(unattendedTask != null) - { - _requestContent = SafeJsonConvert.SerializeObject(unattendedTask, this.Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete unattended task. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (this.Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (this.Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteResource", tracingParameters); - } - // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/unattendedtasks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (this.Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - HttpRequestMessage _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); - } - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Modify properties of unattended tasks. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> PatchResourceWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (this.Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (unattendedTask == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "unattendedTask"); - } - if (this.Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("unattendedTask", unattendedTask); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PatchResource", tracingParameters); - } - // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/unattendedtasks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (this.Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - HttpRequestMessage _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); - } - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(unattendedTask != null) - { - _requestContent = SafeJsonConvert.SerializeObject(unattendedTask, this.Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Execute an unattended task. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync( - resourceGroupName, labName, name, customHeaders, cancellationToken); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); - } - - /// - /// Execute an unattended task. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (this.Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (this.Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); - } - // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/unattendedtasks/{name}/execute").ToString(); - _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (this.Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - HttpRequestMessage _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); - } - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List unattended tasks. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - HttpRequestMessage _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); - } - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/UnattendedTaskOperationsExtensions.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/UnattendedTaskOperationsExtensions.cs deleted file mode 100644 index ac419f6ba432..000000000000 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/UnattendedTaskOperationsExtensions.cs +++ /dev/null @@ -1,436 +0,0 @@ -// 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 0.16.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.DevTestLabs -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Rest; - using Microsoft.Rest.Azure.OData; - using Microsoft.Rest.Azure; - using Models; - - /// - /// Extension methods for UnattendedTaskOperations. - /// - public static partial class UnattendedTaskOperationsExtensions - { - /// - /// List unattended tasks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).ListAsync(resourceGroupName, labName, odataQuery), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// List unattended tasks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get unattended task. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - public static UnattendedTask GetResource(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name) - { - return Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).GetResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Get unattended task. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The cancellation token. - /// - public static async Task GetResourceAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing unattended task. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - public static UnattendedTask CreateOrUpdateResource(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, UnattendedTask unattendedTask) - { - return Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).CreateOrUpdateResourceAsync(resourceGroupName, labName, name, unattendedTask), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing unattended task. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateResourceAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateResourceWithHttpMessagesAsync(resourceGroupName, labName, name, unattendedTask, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing unattended task. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - public static UnattendedTask BeginCreateOrUpdateResource(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, UnattendedTask unattendedTask) - { - return Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).BeginCreateOrUpdateResourceAsync(resourceGroupName, labName, name, unattendedTask), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing unattended task. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateResourceAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateResourceWithHttpMessagesAsync(resourceGroupName, labName, name, unattendedTask, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete unattended task. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - public static void DeleteResource(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name) - { - Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).DeleteResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Delete unattended task. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteResourceAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - await operations.DeleteResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); - } - - /// - /// Modify properties of unattended tasks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - public static UnattendedTask PatchResource(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, UnattendedTask unattendedTask) - { - return Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).PatchResourceAsync(resourceGroupName, labName, name, unattendedTask), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Modify properties of unattended tasks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task PatchResourceAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, UnattendedTask unattendedTask, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PatchResourceWithHttpMessagesAsync(resourceGroupName, labName, name, unattendedTask, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Execute an unattended task. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - public static void Execute(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name) - { - Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).ExecuteAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Execute an unattended task. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); - } - - /// - /// Execute an unattended task. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - public static void BeginExecute(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name) - { - Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).BeginExecuteAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Execute an unattended task. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the unattended task. - /// - /// - /// The cancellation token. - /// - public static async Task BeginExecuteAsync(this IUnattendedTaskOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false); - } - - /// - /// List unattended tasks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IUnattendedTaskOperations operations, string nextPageLink) - { - return Task.Factory.StartNew(s => ((IUnattendedTaskOperations)s).ListNextAsync(nextPageLink), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// List unattended tasks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IUnattendedTaskOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperations.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperations.cs index e36c0cb6d53f..6ec9e2e9a76c 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperations.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperations.cs @@ -1104,7 +1104,7 @@ internal VirtualMachineOperations(DevTestLabsClient client) /// /// The name of the virtual Machine. /// - /// + /// /// /// /// The headers that will be added to request. @@ -1112,11 +1112,11 @@ internal VirtualMachineOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request AzureOperationResponse _response = await BeginApplyArtifactsWithHttpMessagesAsync( - resourceGroupName, labName, name, listOfartifactInstallProperties, customHeaders, cancellationToken); + resourceGroupName, labName, name, applyArtifactsRequest, customHeaders, cancellationToken); return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); } @@ -1132,7 +1132,7 @@ internal VirtualMachineOperations(DevTestLabsClient client) /// /// The name of the virtual Machine. /// - /// + /// /// /// /// Headers that will be added to request. @@ -1143,7 +1143,7 @@ internal VirtualMachineOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (this.Client.SubscriptionId == null) { @@ -1161,9 +1161,9 @@ internal VirtualMachineOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (listOfartifactInstallProperties == null) + if (applyArtifactsRequest == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "listOfartifactInstallProperties"); + throw new ValidationException(ValidationRules.CannotBeNull, "applyArtifactsRequest"); } if (this.Client.ApiVersion == null) { @@ -1179,7 +1179,7 @@ internal VirtualMachineOperations(DevTestLabsClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); - tracingParameters.Add("listOfartifactInstallProperties", listOfartifactInstallProperties); + tracingParameters.Add("applyArtifactsRequest", applyArtifactsRequest); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginApplyArtifacts", tracingParameters); } @@ -1231,9 +1231,9 @@ internal VirtualMachineOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; - if(listOfartifactInstallProperties != null) + if(applyArtifactsRequest != null) { - _requestContent = SafeJsonConvert.SerializeObject(listOfartifactInstallProperties, this.Client.SerializationSettings); + _requestContent = SafeJsonConvert.SerializeObject(applyArtifactsRequest, this.Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8); _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperationsExtensions.cs b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperationsExtensions.cs index 1646c8e14fd9..eec26bf46855 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperationsExtensions.cs +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/Generated/VirtualMachineOperationsExtensions.cs @@ -370,11 +370,11 @@ public static LabVirtualMachine PatchResource(this IVirtualMachineOperations ope /// /// The name of the virtual Machine. /// - /// + /// /// - public static void ApplyArtifacts(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties) + public static void ApplyArtifacts(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) { - Task.Factory.StartNew(s => ((IVirtualMachineOperations)s).ApplyArtifactsAsync(resourceGroupName, labName, name, listOfartifactInstallProperties), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + Task.Factory.StartNew(s => ((IVirtualMachineOperations)s).ApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } /// @@ -392,14 +392,14 @@ public static void ApplyArtifacts(this IVirtualMachineOperations operations, str /// /// The name of the virtual Machine. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task ApplyArtifactsAsync(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ApplyArtifactsAsync(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.ApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, listOfartifactInstallProperties, null, cancellationToken).ConfigureAwait(false); + await operations.ApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false); } /// @@ -417,11 +417,11 @@ public static void ApplyArtifacts(this IVirtualMachineOperations operations, str /// /// The name of the virtual Machine. /// - /// + /// /// - public static void BeginApplyArtifacts(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties) + public static void BeginApplyArtifacts(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) { - Task.Factory.StartNew(s => ((IVirtualMachineOperations)s).BeginApplyArtifactsAsync(resourceGroupName, labName, name, listOfartifactInstallProperties), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + Task.Factory.StartNew(s => ((IVirtualMachineOperations)s).BeginApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } /// @@ -439,14 +439,14 @@ public static void BeginApplyArtifacts(this IVirtualMachineOperations operations /// /// The name of the virtual Machine. /// - /// + /// /// /// /// The cancellation token. /// - public static async Task BeginApplyArtifactsAsync(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, IList listOfartifactInstallProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginApplyArtifactsAsync(this IVirtualMachineOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.BeginApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, listOfartifactInstallProperties, null, cancellationToken).ConfigureAwait(false); + await operations.BeginApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false); } /// diff --git a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/project.json b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/project.json index 185b17445388..6163d4791bf4 100644 --- a/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/project.json +++ b/src/ResourceManagement/DevTestLabs/Microsoft.Azure.Management.DevTestLabs/project.json @@ -1,5 +1,5 @@ { - "version": "1.0.0-preview", + "version": "1.0.1-preview", "description": "Microsoft.Azure.Management.DevTestLabs", "authors": [ "Microsoft" ], "tags": [ "Microsoft AutoRest Management REST" ],