Skip to content

Commit

Permalink
Code gen for ADL (part 3)
Browse files Browse the repository at this point in the history
* Updating to the correct commit number:
Azure/azure-rest-api-specs#1452
  • Loading branch information
ro-joowan committed Jul 25, 2017
1 parent d97f093 commit 0bbe518
Show file tree
Hide file tree
Showing 11 changed files with 271 additions and 271 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ internal AccountOperations(DataLakeAnalyticsAccountManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 201 && (int)_statusCode != 200)
if ((int)_statusCode != 200 && (int)_statusCode != 201)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
Expand Down Expand Up @@ -949,7 +949,7 @@ internal AccountOperations(DataLakeAnalyticsAccountManagementClient client)
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 201)
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
Expand All @@ -967,7 +967,7 @@ internal AccountOperations(DataLakeAnalyticsAccountManagementClient client)
}
}
// Deserialize Response
if ((int)_statusCode == 200)
if ((int)_statusCode == 201)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,16 @@ public partial interface IJobOperations
/// </exception>
Task<AzureOperationResponse> CancelWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Gets the job information for the specified job ID.
/// Submits a job to the specified Data Lake Analytics account.
/// </summary>
/// <param name='accountName'>
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// JobInfo ID.
/// The job ID (a GUID) for the job being submitted.
/// </param>
/// <param name='parameters'>
/// The parameters to submit a job.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
Expand All @@ -147,18 +150,15 @@ public partial interface IJobOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<JobInformation>> GetWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<JobInformation>> CreateWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, CreateJobParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Submits a job to the specified Data Lake Analytics account.
/// Gets the job information for the specified job ID.
/// </summary>
/// <param name='accountName'>
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// The job ID (a GUID) for the job being submitted.
/// </param>
/// <param name='parameters'>
/// The parameters to submit a job.
/// JobInfo ID.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
Expand All @@ -175,7 +175,7 @@ public partial interface IJobOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<JobInformation>> CreateWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, CreateJobParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<JobInformation>> GetWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Lists the jobs, if any, associated with the specified Data Lake
/// Analytics account. The response includes a link to the next page of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,13 +814,16 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
}

/// <summary>
/// Gets the job information for the specified job ID.
/// Submits a job to the specified Data Lake Analytics account.
/// </summary>
/// <param name='accountName'>
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// JobInfo ID.
/// The job ID (a GUID) for the job being submitted.
/// </param>
/// <param name='parameters'>
/// The parameters to submit a job.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
Expand All @@ -843,7 +846,7 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<JobInformation>> GetWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<JobInformation>> CreateWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, CreateJobParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (accountName == null)
{
Expand All @@ -853,6 +856,14 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AdlaJobDnsSuffix");
}
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
if (parameters != null)
{
parameters.Validate();
}
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
Expand All @@ -866,8 +877,9 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("accountName", accountName);
tracingParameters.Add("jobIdentity", jobIdentity);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri;
Expand All @@ -887,7 +899,7 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.Method = new HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
Expand Down Expand Up @@ -918,6 +930,12 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)

// Serialize Request
string _requestContent = null;
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 (Client.Credentials != null)
{
Expand Down Expand Up @@ -1006,16 +1024,13 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
}

/// <summary>
/// Submits a job to the specified Data Lake Analytics account.
/// Gets the job information for the specified job ID.
/// </summary>
/// <param name='accountName'>
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// The job ID (a GUID) for the job being submitted.
/// </param>
/// <param name='parameters'>
/// The parameters to submit a job.
/// JobInfo ID.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
Expand All @@ -1038,7 +1053,7 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<JobInformation>> CreateWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, CreateJobParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<JobInformation>> GetWithHttpMessagesAsync(string accountName, System.Guid jobIdentity, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (accountName == null)
{
Expand All @@ -1048,14 +1063,6 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AdlaJobDnsSuffix");
}
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
if (parameters != null)
{
parameters.Validate();
}
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
Expand All @@ -1069,9 +1076,8 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("accountName", accountName);
tracingParameters.Add("jobIdentity", jobIdentity);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri;
Expand All @@ -1091,7 +1097,7 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PUT");
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
Expand Down Expand Up @@ -1122,12 +1128,6 @@ internal JobOperations(DataLakeAnalyticsJobManagementClient client)

// Serialize Request
string _requestContent = null;
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 (Client.Credentials != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static void Cancel(this IJobOperations operations, string accountName, Sy
}

/// <summary>
/// Gets the job information for the specified job ID.
/// Submits a job to the specified Data Lake Analytics account.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -192,15 +192,18 @@ public static void Cancel(this IJobOperations operations, string accountName, Sy
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// JobInfo ID.
/// The job ID (a GUID) for the job being submitted.
/// </param>
public static JobInformation Get(this IJobOperations operations, string accountName, System.Guid jobIdentity)
/// <param name='parameters'>
/// The parameters to submit a job.
/// </param>
public static JobInformation Create(this IJobOperations operations, string accountName, System.Guid jobIdentity, CreateJobParameters parameters)
{
return operations.GetAsync(accountName, jobIdentity).GetAwaiter().GetResult();
return operations.CreateAsync(accountName, jobIdentity, parameters).GetAwaiter().GetResult();
}

/// <summary>
/// Gets the job information for the specified job ID.
/// Submits a job to the specified Data Lake Analytics account.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -209,21 +212,24 @@ public static JobInformation Get(this IJobOperations operations, string accountN
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// JobInfo ID.
/// The job ID (a GUID) for the job being submitted.
/// </param>
/// <param name='parameters'>
/// The parameters to submit a job.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<JobInformation> GetAsync(this IJobOperations operations, string accountName, System.Guid jobIdentity, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<JobInformation> CreateAsync(this IJobOperations operations, string accountName, System.Guid jobIdentity, CreateJobParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(accountName, jobIdentity, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.CreateWithHttpMessagesAsync(accountName, jobIdentity, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Submits a job to the specified Data Lake Analytics account.
/// Gets the job information for the specified job ID.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -232,18 +238,15 @@ public static JobInformation Get(this IJobOperations operations, string accountN
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// The job ID (a GUID) for the job being submitted.
/// </param>
/// <param name='parameters'>
/// The parameters to submit a job.
/// JobInfo ID.
/// </param>
public static JobInformation Create(this IJobOperations operations, string accountName, System.Guid jobIdentity, CreateJobParameters parameters)
public static JobInformation Get(this IJobOperations operations, string accountName, System.Guid jobIdentity)
{
return operations.CreateAsync(accountName, jobIdentity, parameters).GetAwaiter().GetResult();
return operations.GetAsync(accountName, jobIdentity).GetAwaiter().GetResult();
}

/// <summary>
/// Submits a job to the specified Data Lake Analytics account.
/// Gets the job information for the specified job ID.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -252,17 +255,14 @@ public static JobInformation Create(this IJobOperations operations, string accou
/// The Azure Data Lake Analytics account to execute job operations on.
/// </param>
/// <param name='jobIdentity'>
/// The job ID (a GUID) for the job being submitted.
/// </param>
/// <param name='parameters'>
/// The parameters to submit a job.
/// JobInfo ID.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<JobInformation> CreateAsync(this IJobOperations operations, string accountName, System.Guid jobIdentity, CreateJobParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<JobInformation> GetAsync(this IJobOperations operations, string accountName, System.Guid jobIdentity, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateWithHttpMessagesAsync(accountName, jobIdentity, parameters, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.GetWithHttpMessagesAsync(accountName, jobIdentity, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Loading

0 comments on commit 0bbe518

Please sign in to comment.