diff --git a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobCollectionsOperations.cs b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobCollectionsOperations.cs
index 627b869184b5f..568b6a967e078 100644
--- a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobCollectionsOperations.cs
+++ b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobCollectionsOperations.cs
@@ -1,16 +1,16 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+//
+//
namespace Microsoft.Azure.Management.Scheduler
{
- using System;
- using System.Collections.Generic;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// JobCollectionsOperations operations.
@@ -26,6 +26,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Gets all job collections under specified resource group.
@@ -39,6 +48,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Gets a job collection.
@@ -55,6 +73,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task> GetWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Provisions a new job collection or updates an existing job
@@ -75,6 +102,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, JobCollectionDefinition jobCollection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Patches an existing job collection.
@@ -94,6 +130,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task> PatchWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, JobCollectionDefinition jobCollection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Deletes a job collection.
@@ -110,9 +155,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task DeleteWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Deletes a job collection.
+ /// Enables all of the jobs in the job collection.
///
///
/// The resource group name.
@@ -126,9 +177,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
- Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task EnableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Enables all of the jobs in the job collection.
+ /// Disables all of the jobs in the job collection.
///
///
/// The resource group name.
@@ -142,9 +199,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
- Task EnableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DisableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Enables all of the jobs in the job collection.
+ /// Deletes a job collection.
///
///
/// The resource group name.
@@ -158,9 +221,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
- Task BeginEnableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Disables all of the jobs in the job collection.
+ /// Enables all of the jobs in the job collection.
///
///
/// The resource group name.
@@ -174,7 +243,13 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
- Task DisableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginEnableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Disables all of the jobs in the job collection.
///
@@ -190,6 +265,12 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task BeginDisableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Gets all job collections under specified subscription.
@@ -203,6 +284,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Gets all job collections under specified resource group.
@@ -216,6 +306,15 @@ public partial interface IJobCollectionsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobsOperations.cs b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobsOperations.cs
index 4b95c22571b29..8a437e3cf5cd5 100644
--- a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobsOperations.cs
+++ b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/IJobsOperations.cs
@@ -1,17 +1,17 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+//
+//
namespace Microsoft.Azure.Management.Scheduler
{
- 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 Microsoft.Rest.Azure.OData;
using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// JobsOperations operations.
@@ -36,6 +36,15 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task> GetWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Provisions a new job or updates an existing job.
@@ -58,6 +67,15 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, JobDefinition job, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Patches an existing job.
@@ -80,6 +98,15 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task> PatchWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, JobDefinition job, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Deletes a job.
@@ -99,6 +126,12 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task DeleteWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Runs a job.
@@ -118,6 +151,12 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task RunWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Lists all jobs under the specified job collection.
@@ -137,6 +176,15 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Lists job history.
@@ -159,6 +207,15 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListJobHistoryWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Lists all jobs under the specified job collection.
@@ -172,6 +229,15 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Lists job history.
@@ -185,6 +251,15 @@ public partial interface IJobsOperations
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
Task>> ListJobHistoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/ISchedulerManagementClient.cs b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/ISchedulerManagementClient.cs
index f9122e1c689cc..d3a98d9792608 100644
--- a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/ISchedulerManagementClient.cs
+++ b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/ISchedulerManagementClient.cs
@@ -1,26 +1,22 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+//
+//
namespace Microsoft.Azure.Management.Scheduler
{
- using System;
- using System.Collections.Generic;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
- using Newtonsoft.Json;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
+ using Newtonsoft.Json;
///
///
- public partial interface ISchedulerManagementClient : IDisposable
+ public partial interface ISchedulerManagementClient : System.IDisposable
{
///
/// The base URI of the service.
///
- Uri BaseUri { get; set; }
+ System.Uri BaseUri { get; set; }
///
/// Gets or sets json serialization settings.
@@ -33,7 +29,7 @@ public partial interface ISchedulerManagementClient : IDisposable
JsonSerializerSettings DeserializationSettings { get; }
///
- /// Gets Azure subscription credentials.
+ /// Credentials needed for the client to connect to Azure.
///
ServiceClientCredentials Credentials { get; }
@@ -48,19 +44,20 @@ public partial interface ISchedulerManagementClient : IDisposable
string ApiVersion { get; }
///
- /// Gets or sets the preferred language for the response.
+ /// The preferred language for the response.
///
string AcceptLanguage { get; set; }
///
- /// Gets or sets the retry timeout in seconds for Long Running
- /// Operations. Default value is 30.
+ /// The retry timeout in seconds for Long Running Operations. Default
+ /// value is 30.
///
int? LongRunningOperationRetryTimeout { get; set; }
///
- /// When set to true a unique x-ms-client-request-id value is
- /// generated and included in each request. Default is true.
+ /// Whether a unique x-ms-client-request-id should be generated. When
+ /// set to true a unique x-ms-client-request-id value is generated and
+ /// included in each request. Default is true.
///
bool? GenerateClientRequestId { get; set; }
diff --git a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperations.cs b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperations.cs
index 0f811f82dc5da..ffebf84fc7fc4 100644
--- a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperations.cs
+++ b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperations.cs
@@ -1,23 +1,20 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+//
+//
namespace Microsoft.Azure.Management.Scheduler
{
- using System;
- using System.Linq;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
using System.Collections.Generic;
+ using System.Linq;
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;
- using Models;
///
/// JobCollectionsOperations operations.
@@ -30,13 +27,16 @@ internal partial class JobCollectionsOperations : IServiceOperations
/// Reference to the service client.
///
+ ///
+ /// Thrown when a required parameter is null
+ ///
internal JobCollectionsOperations(SchedulerManagementClient client)
{
- if (client == null)
+ if (client == null)
{
- throw new ArgumentNullException("client");
+ throw new System.ArgumentNullException("client");
}
- this.Client = client;
+ Client = client;
}
///
@@ -53,16 +53,28 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -77,36 +89,38 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -122,10 +136,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -133,7 +147,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -147,7 +161,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -189,7 +203,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -220,12 +234,24 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -233,7 +259,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -249,37 +275,39 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -295,10 +323,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -306,7 +334,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -320,7 +348,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -362,7 +390,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -396,12 +424,24 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -413,7 +453,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobCollectionName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -430,38 +470,40 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -477,10 +519,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -488,7 +530,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -502,7 +544,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -544,7 +586,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -581,12 +623,24 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, JobCollectionDefinition jobCollection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -598,7 +652,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobCollectionName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -620,38 +674,40 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PUT");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -668,15 +724,15 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
string _requestContent = null;
if(jobCollection != null)
{
- _requestContent = SafeJsonConvert.SerializeObject(jobCollection, this.Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(jobCollection, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -684,7 +740,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -698,7 +754,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -740,7 +796,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -758,7 +814,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -795,12 +851,24 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task> PatchWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, JobCollectionDefinition jobCollection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -812,7 +880,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobCollectionName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -834,38 +902,40 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "Patch", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PATCH");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -882,15 +952,15 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
string _requestContent = null;
if(jobCollection != null)
{
- _requestContent = SafeJsonConvert.SerializeObject(jobCollection, this.Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(jobCollection, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -898,7 +968,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -912,7 +982,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -954,7 +1024,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -991,9 +1061,52 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(
- resourceGroupName, jobCollectionName, customHeaders, cancellationToken);
- return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken);
+ AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, jobCollectionName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Enables all of the jobs in the job collection.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The job collection name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task EnableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginEnableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Disables all of the jobs in the job collection.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The job collection name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task DisableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginDisableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
@@ -1011,12 +1124,21 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -1028,7 +1150,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobCollectionName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -1045,38 +1167,40 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("DELETE");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1092,10 +1216,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1103,7 +1227,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1114,7 +1238,20 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, 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"))
@@ -1147,29 +1284,6 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
return _result;
}
- ///
- /// Enables all of the jobs in the job collection.
- ///
- ///
- /// The resource group name.
- ///
- ///
- /// The job collection name.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task EnableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginEnableWithHttpMessagesAsync(
- resourceGroupName, jobCollectionName, customHeaders, cancellationToken);
- return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken);
- }
-
///
/// Enables all of the jobs in the job collection.
///
@@ -1185,12 +1299,21 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task BeginEnableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -1202,7 +1325,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobCollectionName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -1219,38 +1342,40 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "BeginEnable", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1266,10 +1391,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1277,7 +1402,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1288,7 +1413,20 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, 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"))
@@ -1321,29 +1459,6 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
return _result;
}
- ///
- /// Disables all of the jobs in the job collection.
- ///
- ///
- /// The resource group name.
- ///
- ///
- /// The job collection name.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task DisableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginDisableWithHttpMessagesAsync(
- resourceGroupName, jobCollectionName, customHeaders, cancellationToken);
- return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken);
- }
-
///
/// Disables all of the jobs in the job collection.
///
@@ -1359,12 +1474,21 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task BeginDisableWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -1376,7 +1500,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobCollectionName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -1393,38 +1517,40 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "BeginDisable", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1440,10 +1566,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1451,7 +1577,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1462,7 +1588,20 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, 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"))
@@ -1507,6 +1646,18 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
@@ -1533,26 +1684,28 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1568,10 +1721,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1579,7 +1732,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1593,7 +1746,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -1635,7 +1788,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -1666,6 +1819,18 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
@@ -1692,26 +1857,28 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1727,10 +1894,10 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1738,7 +1905,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1752,7 +1919,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -1794,7 +1961,7 @@ internal JobCollectionsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperationsExtensions.cs b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperationsExtensions.cs
index 66389bbbc3042..23d386bdfa0ef 100644
--- a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperationsExtensions.cs
+++ b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobCollectionsOperationsExtensions.cs
@@ -1,16 +1,14 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+//
+//
namespace Microsoft.Azure.Management.Scheduler
{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// Extension methods for JobCollectionsOperations.
@@ -25,7 +23,7 @@ public static partial class JobCollectionsOperationsExtensions
///
public static IPage ListBySubscription(this IJobCollectionsOperations operations)
{
- return Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).ListBySubscriptionAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListBySubscriptionAsync().GetAwaiter().GetResult();
}
///
@@ -56,7 +54,7 @@ public static IPage ListBySubscription(this IJobCollect
///
public static IPage ListByResourceGroup(this IJobCollectionsOperations operations, string resourceGroupName)
{
- return Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).ListByResourceGroupAsync(resourceGroupName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult();
}
///
@@ -93,7 +91,7 @@ public static IPage ListByResourceGroup(this IJobCollec
///
public static JobCollectionDefinition Get(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
{
- return Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).GetAsync(resourceGroupName, jobCollectionName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, jobCollectionName).GetAwaiter().GetResult();
}
///
@@ -136,7 +134,7 @@ public static JobCollectionDefinition Get(this IJobCollectionsOperations operati
///
public static JobCollectionDefinition CreateOrUpdate(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, JobCollectionDefinition jobCollection)
{
- return Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).CreateOrUpdateAsync(resourceGroupName, jobCollectionName, jobCollection), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, jobCollectionName, jobCollection).GetAwaiter().GetResult();
}
///
@@ -182,7 +180,7 @@ public static JobCollectionDefinition CreateOrUpdate(this IJobCollectionsOperati
///
public static JobCollectionDefinition Patch(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, JobCollectionDefinition jobCollection)
{
- return Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).PatchAsync(resourceGroupName, jobCollectionName, jobCollection), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.PatchAsync(resourceGroupName, jobCollectionName, jobCollection).GetAwaiter().GetResult();
}
///
@@ -225,7 +223,7 @@ public static JobCollectionDefinition Patch(this IJobCollectionsOperations opera
///
public static void Delete(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
{
- Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).DeleteAsync(resourceGroupName, jobCollectionName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, jobCollectionName).GetAwaiter().GetResult();
}
///
@@ -245,11 +243,11 @@ public static void Delete(this IJobCollectionsOperations operations, string reso
///
public static async Task DeleteAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.DeleteWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// Deletes a job collection.
+ /// Enables all of the jobs in the job collection.
///
///
/// The operations group for this extension method.
@@ -260,13 +258,13 @@ public static void Delete(this IJobCollectionsOperations operations, string reso
///
/// The job collection name.
///
- public static void BeginDelete(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
+ public static void Enable(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
{
- Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).BeginDeleteAsync(resourceGroupName, jobCollectionName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.EnableAsync(resourceGroupName, jobCollectionName).GetAwaiter().GetResult();
}
///
- /// Deletes a job collection.
+ /// Enables all of the jobs in the job collection.
///
///
/// The operations group for this extension method.
@@ -280,13 +278,13 @@ public static void BeginDelete(this IJobCollectionsOperations operations, string
///
/// The cancellation token.
///
- public static async Task BeginDeleteAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task EnableAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.EnableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// Enables all of the jobs in the job collection.
+ /// Disables all of the jobs in the job collection.
///
///
/// The operations group for this extension method.
@@ -297,13 +295,13 @@ public static void BeginDelete(this IJobCollectionsOperations operations, string
///
/// The job collection name.
///
- public static void Enable(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
+ public static void Disable(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
{
- Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).EnableAsync(resourceGroupName, jobCollectionName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.DisableAsync(resourceGroupName, jobCollectionName).GetAwaiter().GetResult();
}
///
- /// Enables all of the jobs in the job collection.
+ /// Disables all of the jobs in the job collection.
///
///
/// The operations group for this extension method.
@@ -317,13 +315,13 @@ public static void Enable(this IJobCollectionsOperations operations, string reso
///
/// The cancellation token.
///
- public static async Task EnableAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DisableAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.EnableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.DisableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// Enables all of the jobs in the job collection.
+ /// Deletes a job collection.
///
///
/// The operations group for this extension method.
@@ -334,13 +332,13 @@ public static void Enable(this IJobCollectionsOperations operations, string reso
///
/// The job collection name.
///
- public static void BeginEnable(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
+ public static void BeginDelete(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
{
- Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).BeginEnableAsync(resourceGroupName, jobCollectionName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.BeginDeleteAsync(resourceGroupName, jobCollectionName).GetAwaiter().GetResult();
}
///
- /// Enables all of the jobs in the job collection.
+ /// Deletes a job collection.
///
///
/// The operations group for this extension method.
@@ -354,13 +352,13 @@ public static void BeginEnable(this IJobCollectionsOperations operations, string
///
/// The cancellation token.
///
- public static async Task BeginEnableAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginDeleteAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginEnableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// Disables all of the jobs in the job collection.
+ /// Enables all of the jobs in the job collection.
///
///
/// The operations group for this extension method.
@@ -371,13 +369,13 @@ public static void BeginEnable(this IJobCollectionsOperations operations, string
///
/// The job collection name.
///
- public static void Disable(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
+ public static void BeginEnable(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
{
- Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).DisableAsync(resourceGroupName, jobCollectionName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.BeginEnableAsync(resourceGroupName, jobCollectionName).GetAwaiter().GetResult();
}
///
- /// Disables all of the jobs in the job collection.
+ /// Enables all of the jobs in the job collection.
///
///
/// The operations group for this extension method.
@@ -391,9 +389,9 @@ public static void Disable(this IJobCollectionsOperations operations, string res
///
/// The cancellation token.
///
- public static async Task DisableAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginEnableAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.DisableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginEnableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -410,7 +408,7 @@ public static void Disable(this IJobCollectionsOperations operations, string res
///
public static void BeginDisable(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName)
{
- Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).BeginDisableAsync(resourceGroupName, jobCollectionName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.BeginDisableAsync(resourceGroupName, jobCollectionName).GetAwaiter().GetResult();
}
///
@@ -430,7 +428,7 @@ public static void BeginDisable(this IJobCollectionsOperations operations, strin
///
public static async Task BeginDisableAsync(this IJobCollectionsOperations operations, string resourceGroupName, string jobCollectionName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginDisableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginDisableWithHttpMessagesAsync(resourceGroupName, jobCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -444,7 +442,7 @@ public static void BeginDisable(this IJobCollectionsOperations operations, strin
///
public static IPage ListBySubscriptionNext(this IJobCollectionsOperations operations, string nextPageLink)
{
- return Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).ListBySubscriptionNextAsync(nextPageLink), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult();
}
///
@@ -478,7 +476,7 @@ public static IPage ListBySubscriptionNext(this IJobCol
///
public static IPage ListByResourceGroupNext(this IJobCollectionsOperations operations, string nextPageLink)
{
- return Task.Factory.StartNew(s => ((IJobCollectionsOperations)s).ListByResourceGroupNextAsync(nextPageLink), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult();
}
///
diff --git a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperations.cs b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperations.cs
index 6874c7503655f..ae25d4be5dc30 100644
--- a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperations.cs
+++ b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperations.cs
@@ -1,24 +1,21 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+//
+//
namespace Microsoft.Azure.Management.Scheduler
{
- using System;
- using System.Linq;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
using System.Collections.Generic;
+ using System.Linq;
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;
///
/// JobsOperations operations.
@@ -31,13 +28,16 @@ internal partial class JobsOperations : IServiceOperations
/// Reference to the service client.
///
+ ///
+ /// Thrown when a required parameter is null
+ ///
internal JobsOperations(SchedulerManagementClient client)
{
- if (client == null)
+ if (client == null)
{
- throw new ArgumentNullException("client");
+ throw new System.ArgumentNullException("client");
}
- this.Client = client;
+ Client = client;
}
///
@@ -63,12 +63,24 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -84,7 +96,7 @@ internal JobsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -102,39 +114,41 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
- _url = _url.Replace("{jobName}", Uri.EscapeDataString(jobName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
+ _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,10 +164,10 @@ internal JobsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -161,7 +175,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -175,7 +189,7 @@ internal JobsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -217,7 +231,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -257,12 +271,24 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, JobDefinition job, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -278,7 +304,7 @@ internal JobsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -301,39 +327,41 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
- _url = _url.Replace("{jobName}", Uri.EscapeDataString(jobName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
+ _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PUT");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -350,15 +378,15 @@ internal JobsOperations(SchedulerManagementClient client)
string _requestContent = null;
if(job != null)
{
- _requestContent = SafeJsonConvert.SerializeObject(job, this.Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(job, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -366,7 +394,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -380,7 +408,7 @@ internal JobsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -422,7 +450,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -440,7 +468,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -480,12 +508,24 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task> PatchWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, JobDefinition job, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -501,7 +541,7 @@ internal JobsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -524,39 +564,41 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "Patch", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
- _url = _url.Replace("{jobName}", Uri.EscapeDataString(jobName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
+ _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PATCH");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -573,15 +615,15 @@ internal JobsOperations(SchedulerManagementClient client)
string _requestContent = null;
if(job != null)
{
- _requestContent = SafeJsonConvert.SerializeObject(job, this.Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(job, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -589,7 +631,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -603,7 +645,7 @@ internal JobsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -645,7 +687,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -682,12 +724,21 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -703,7 +754,7 @@ internal JobsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -721,39 +772,41 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
- _url = _url.Replace("{jobName}", Uri.EscapeDataString(jobName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
+ _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("DELETE");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -769,10 +822,10 @@ internal JobsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -780,7 +833,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -791,7 +844,20 @@ internal JobsOperations(SchedulerManagementClient client)
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, 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"))
@@ -842,12 +908,21 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task RunWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -863,7 +938,7 @@ internal JobsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -881,39 +956,41 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "Run", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
- _url = _url.Replace("{jobName}", Uri.EscapeDataString(jobName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
+ _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName));
List _queryParameters = new List();
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -929,10 +1006,10 @@ internal JobsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -940,7 +1017,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -951,7 +1028,20 @@ internal JobsOperations(SchedulerManagementClient client)
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, 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"))
@@ -1002,12 +1092,24 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -1019,7 +1121,7 @@ internal JobsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobCollectionName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -1037,46 +1139,48 @@ internal JobsOperations(SchedulerManagementClient client)
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.Scheduler/jobCollections/{jobCollectionName}/jobs").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
List _queryParameters = new List();
if (odataQuery != null)
{
- var _odataFilter = odataQuery.ToString().Replace("'", string.Empty);
- if (!string.IsNullOrEmpty(_odataFilter))
+ var _odataFilter = odataQuery.ToString();
+ if (!string.IsNullOrEmpty(_odataFilter))
{
_queryParameters.Add(_odataFilter);
}
}
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1092,10 +1196,10 @@ internal JobsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1103,7 +1207,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1117,7 +1221,7 @@ internal JobsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -1159,7 +1263,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -1199,12 +1303,24 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task>> ListJobHistoryWithHttpMessagesAsync(string resourceGroupName, string jobCollectionName, string jobName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
@@ -1220,7 +1336,7 @@ internal JobsOperations(SchedulerManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "jobName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
@@ -1239,47 +1355,49 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.Enter(_invocationId, this, "ListJobHistory", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
- var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history").ToString();
- _url = _url.Replace("{subscriptionId}", Uri.EscapeDataString(this.Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{jobCollectionName}", Uri.EscapeDataString(jobCollectionName));
- _url = _url.Replace("{jobName}", Uri.EscapeDataString(jobName));
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{jobCollectionName}", System.Uri.EscapeDataString(jobCollectionName));
+ _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName));
List _queryParameters = new List();
if (odataQuery != null)
{
- var _odataFilter = odataQuery.ToString().Replace("'", string.Empty);
- if (!string.IsNullOrEmpty(_odataFilter))
+ var _odataFilter = odataQuery.ToString();
+ if (!string.IsNullOrEmpty(_odataFilter))
{
_queryParameters.Add(_odataFilter);
}
}
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", Uri.EscapeDataString(this.Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1295,10 +1413,10 @@ internal JobsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1306,7 +1424,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1320,7 +1438,7 @@ internal JobsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -1362,7 +1480,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -1393,6 +1511,18 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
@@ -1419,26 +1549,28 @@ internal JobsOperations(SchedulerManagementClient client)
List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1454,10 +1586,10 @@ internal JobsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1465,7 +1597,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1479,7 +1611,7 @@ internal JobsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -1521,7 +1653,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -1552,6 +1684,18 @@ internal JobsOperations(SchedulerManagementClient client)
///
/// The cancellation token.
///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
@@ -1578,26 +1722,28 @@ internal JobsOperations(SchedulerManagementClient client)
List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
- _url += "?" + string.Join("&", _queryParameters);
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- HttpRequestMessage _httpRequest = new HttpRequestMessage();
+ var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new Uri(_url);
+ _httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1613,10 +1759,10 @@ internal JobsOperations(SchedulerManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
@@ -1624,7 +1770,7 @@ internal JobsOperations(SchedulerManagementClient client)
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
@@ -1638,7 +1784,7 @@ internal JobsOperations(SchedulerManagementClient client)
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
@@ -1680,7 +1826,7 @@ internal JobsOperations(SchedulerManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperationsExtensions.cs b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperationsExtensions.cs
index 2ae2f458d6b78..cdb737954ad49 100644
--- a/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperationsExtensions.cs
+++ b/sdk/scheduler/Microsoft.Azure.Management.Scheduler/src/Generated/JobsOperationsExtensions.cs
@@ -1,17 +1,15 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+//
+//
namespace Microsoft.Azure.Management.Scheduler
{
- 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 Microsoft.Rest.Azure.OData;
using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// Extension methods for JobsOperations.
@@ -35,7 +33,7 @@ public static partial class JobsOperationsExtensions
///
public static JobDefinition Get(this IJobsOperations operations, string resourceGroupName, string jobCollectionName, string jobName)
{
- return Task.Factory.StartNew(s => ((IJobsOperations)s).GetAsync(resourceGroupName, jobCollectionName, jobName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, jobCollectionName, jobName).GetAwaiter().GetResult();
}
///
@@ -84,7 +82,7 @@ public static JobDefinition Get(this IJobsOperations operations, string resource
///
public static JobDefinition CreateOrUpdate(this IJobsOperations operations, string resourceGroupName, string jobCollectionName, string jobName, JobDefinition job)
{
- return Task.Factory.StartNew(s => ((IJobsOperations)s).CreateOrUpdateAsync(resourceGroupName, jobCollectionName, jobName, job), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, jobCollectionName, jobName, job).GetAwaiter().GetResult();
}
///
@@ -136,7 +134,7 @@ public static JobDefinition CreateOrUpdate(this IJobsOperations operations, stri
///
public static JobDefinition Patch(this IJobsOperations operations, string resourceGroupName, string jobCollectionName, string jobName, JobDefinition job)
{
- return Task.Factory.StartNew(s => ((IJobsOperations)s).PatchAsync(resourceGroupName, jobCollectionName, jobName, job), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.PatchAsync(resourceGroupName, jobCollectionName, jobName, job).GetAwaiter().GetResult();
}
///
@@ -185,7 +183,7 @@ public static JobDefinition Patch(this IJobsOperations operations, string resour
///
public static void Delete(this IJobsOperations operations, string resourceGroupName, string jobCollectionName, string jobName)
{
- Task.Factory.StartNew(s => ((IJobsOperations)s).DeleteAsync(resourceGroupName, jobCollectionName, jobName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, jobCollectionName, jobName).GetAwaiter().GetResult();
}
///
@@ -208,7 +206,7 @@ public static void Delete(this IJobsOperations operations, string resourceGroupN
///
public static async Task DeleteAsync(this IJobsOperations operations, string resourceGroupName, string jobCollectionName, string jobName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.DeleteWithHttpMessagesAsync(resourceGroupName, jobCollectionName, jobName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, jobCollectionName, jobName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -228,7 +226,7 @@ public static void Delete(this IJobsOperations operations, string resourceGroupN
///
public static void Run(this IJobsOperations operations, string resourceGroupName, string jobCollectionName, string jobName)
{
- Task.Factory.StartNew(s => ((IJobsOperations)s).RunAsync(resourceGroupName, jobCollectionName, jobName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.RunAsync(resourceGroupName, jobCollectionName, jobName).GetAwaiter().GetResult();
}
///
@@ -251,7 +249,7 @@ public static void Run(this IJobsOperations operations, string resourceGroupName
///
public static async Task RunAsync(this IJobsOperations operations, string resourceGroupName, string jobCollectionName, string jobName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.RunWithHttpMessagesAsync(resourceGroupName, jobCollectionName, jobName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.RunWithHttpMessagesAsync(resourceGroupName, jobCollectionName, jobName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///