Skip to content

Commit

Permalink
Updating code for jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
vinagesh committed Aug 19, 2020
1 parent 7786cc6 commit 3a3fe04
Show file tree
Hide file tree
Showing 64 changed files with 2,434 additions and 1,892 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,16 @@ public enum ServiceVersion
}
public partial class JobsClient
{
public JobsClient() { }
protected JobsClient() { }
public virtual Azure.Response<string> CancelImportExportJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Iot.Hub.Service.Models.JobProperties> CreateExportDevicesJob(System.Uri outputBlobContainerUri, bool excludeKeys, Azure.Iot.Hub.Service.Models.ExportJobRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Iot.Hub.Service.Models.JobProperties>> CreateExportDevicesJobAsync(System.Uri outputBlobContainerUri, bool excludeKeys, Azure.Iot.Hub.Service.Models.ExportJobRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Iot.Hub.Service.Models.JobProperties> CreateImportDevicesJob(System.Uri importBlobContainerUri, System.Uri outputBlobContainerUri, Azure.Iot.Hub.Service.Models.ImportJobRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Iot.Hub.Service.Models.JobProperties>> CreateImportDevicesJobAsync(System.Uri importBlobContainerUri, System.Uri outputBlobContainerUri, Azure.Iot.Hub.Service.Models.ImportJobRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Iot.Hub.Service.Models.JobProperties> GetImportExportJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Iot.Hub.Service.Models.JobProperties>> GetImportExportJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Iot.Hub.Service.Models.JobProperties>> GetImportExportJobs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Iot.Hub.Service.Models.JobProperties>>> GetImportExportJobsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class ModulesClient
{
Expand Down Expand Up @@ -602,6 +611,17 @@ public ExportImportDevice() { }
public static bool operator !=(Azure.Iot.Hub.Service.Models.ExportImportDeviceStatus left, Azure.Iot.Hub.Service.Models.ExportImportDeviceStatus right) { throw null; }
public override string ToString() { throw null; }
}
public partial class ExportJobRequestOptions : Azure.Iot.Hub.Service.Models.JobRequestOptions
{
public ExportJobRequestOptions() { }
public string OutputBlobName { get { throw null; } set { } }
}
public partial class ImportJobRequestOptions : Azure.Iot.Hub.Service.Models.JobRequestOptions
{
public ImportJobRequestOptions() { }
public string InputBloblName { get { throw null; } set { } }
public string OutputBlobName { get { throw null; } set { } }
}
public partial class JobProperties
{
public JobProperties() { }
Expand Down Expand Up @@ -704,6 +724,11 @@ public JobRequest() { }
public Azure.Iot.Hub.Service.Models.JobRequestType? Type { get { throw null; } set { } }
public Azure.Iot.Hub.Service.Models.TwinData UpdateTwin { get { throw null; } set { } }
}
public partial class JobRequestOptions
{
public JobRequestOptions() { }
public Azure.Iot.Hub.Service.Models.JobPropertiesStorageAuthenticationType AuthenticationType { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct JobRequestType : System.IEquatable<Azure.Iot.Hub.Service.Models.JobRequestType>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

namespace Azure.Iot.Hub.Service
{
internal partial class JobRestClient
/// <summary>
/// Override to return string instead of object.
/// </summary>
internal partial class JobsRestClient
{
internal Response<string> CancelImportExportJob(string id, CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -37,6 +40,7 @@ internal Response<string> CancelImportExportJob(string id, CancellationToken can
}
case 204:
return Response.FromValue<string>(null, message.Response);

default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Iot.Hub.Service.Models
{
/// <summary>
/// Optional properties for export jobs.
/// </summary>
public class ExportJobRequestOptions : JobRequestOptions
{
/// <summary>
/// The name of the blob that contains the export devices registry information for the IoT Hub. If not provided by the user, it will default to "devices.txt".
/// </summary>
public string OutputBlobName { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Iot.Hub.Service.Models
{
/// <summary>
/// Optional properties for import jobs.
/// </summary>
public class ImportJobRequestOptions : JobRequestOptions
{
/// <summary>
/// The name of the blob that will contain the status of importing devices. If not provided by the user, it will default to "devices.txt".
/// </summary>
public string InputBlobName { get; set; }

/// <summary>
/// The name of the blob that contains the export devices registry information for the IoT Hub. If not provided by the user, it will default to "devices.txt".
/// </summary>
public string OutputBlobName { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Azure.Iot.Hub.Service.Models
{
/// <summary>
/// Optional properties for the import and export jobs client library.
/// Optional properties for import and export jobs.
/// </summary>
public class JobRequestOptions
{
Expand Down
45 changes: 1 addition & 44 deletions sdk/iot/Azure.Iot.Hub.Service/src/Generated/JobsRestClient.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
4 changes: 3 additions & 1 deletion sdk/iot/Azure.Iot.Hub.Service/src/IotHubServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class IotHubServiceClient
private readonly QueryRestClient _queryRestClient;
private readonly StatisticsRestClient _statisticsRestClient;
private readonly ConfigurationRestClient _configurationRestClient;
private readonly JobsRestClient _jobsRestClient;

/// <summary>
/// place holder for Devices.
Expand Down Expand Up @@ -143,6 +144,7 @@ private IotHubServiceClient(IotHubSasCredential credential, IotHubServiceClientO
_queryRestClient = new QueryRestClient(_clientDiagnostics, _httpPipeline, credential.Endpoint, options.GetVersionString());
_statisticsRestClient = new StatisticsRestClient(_clientDiagnostics, _httpPipeline, credential.Endpoint, options.GetVersionString());
_configurationRestClient = new ConfigurationRestClient(_clientDiagnostics, _httpPipeline, credential.Endpoint, options.GetVersionString());
_jobsRestClient = new JobsRestClient(_clientDiagnostics, _httpPipeline, credential.Endpoint, options.GetVersionString());

// Note that the devices and modules subclient take a reference to the Query convenience layer client. This
// is because they each expose a helper function that uses the query client for listing twins. By passing in
Expand All @@ -156,7 +158,7 @@ private IotHubServiceClient(IotHubSasCredential credential, IotHubServiceClientO

Messages = new CloudToDeviceMessagesClient();
Files = new FilesClient();
Jobs = new JobsClient();
Jobs = new JobsClient(_jobsRestClient);
}

private static IotHubSasCredential SetEndpointToIotHubSasCredential(Uri endpoint, IotHubSasCredential credential)
Expand Down
Loading

0 comments on commit 3a3fe04

Please sign in to comment.