-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Service Client CL and client grouping #12323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
sdk/iot/Azure.Iot.Hub.Service/src/CloudToDeviceMessagesClient.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| { | ||
| /// <summary> | ||
| /// C2D Messages Client place holder | ||
| /// </summary> | ||
| public class CloudToDeviceMessagesClient | ||
| { | ||
| /// <summary> | ||
| /// place holder | ||
| /// </summary> | ||
| #pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| public CloudToDeviceMessagesClient() | ||
| #pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| { | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using Azure.Iot.Hub.Service.Models; | ||
|
|
||
| namespace Azure.Iot.Hub.Service | ||
| { | ||
| /// <summary> | ||
| /// Device Client place holder | ||
| /// </summary> | ||
| public class DevicesClient | ||
| { | ||
| /// <summary> | ||
| /// place holder | ||
| /// </summary> | ||
| #pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| public DevicesClient() | ||
| #pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| { | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace Azure.Iot.Hub.Service | ||
| { | ||
| /// <summary> | ||
| /// Files Client place holder | ||
| /// </summary> | ||
| public class FilesClient | ||
| { | ||
| /// <summary> | ||
| /// place holder | ||
| /// </summary> | ||
| #pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| public FilesClient() | ||
| #pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| { | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Azure.Core; | ||
|
|
||
| namespace Azure.Iot.Hub.Service | ||
| { | ||
| /// <summary> | ||
| /// The IoT Hub Service Client | ||
| /// </summary> | ||
| public class IoTHubServiceClient | ||
| { | ||
| /// <summary> | ||
| /// place holder for Devices | ||
| /// </summary> | ||
| public DevicesClient Devices { get; private set; } | ||
| /// <summary> | ||
| /// place holder for Modules | ||
| /// </summary> | ||
| public ModulesClient Modules { get; private set; } | ||
| /// <summary> | ||
| /// place holder for Statistics | ||
| /// </summary> | ||
| public StatisticsClient Statistics { get; private set; } | ||
| /// <summary> | ||
| /// place holder for Messages | ||
| /// </summary> | ||
| public CloudToDeviceMessagesClient Messages { get; private set; } | ||
| /// <summary> | ||
| /// place holder for Files | ||
| /// </summary> | ||
| public FilesClient Files { get; private set; } | ||
| /// <summary> | ||
| /// place holder for Jobs | ||
| /// </summary> | ||
| public JobsClient Jobs { get; private set; } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="IoTHubServiceClient"/> class. | ||
| /// </summary> | ||
| public IoTHubServiceClient() | ||
| : this(new IoTHubServiceClientOptions()) | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="IoTHubServiceClient"/> class. | ||
| /// </summary> | ||
| public IoTHubServiceClient(IoTHubServiceClientOptions options) | ||
| { | ||
| Argument.AssertNotNull(options, nameof(options)); | ||
|
|
||
| Devices = new DevicesClient(); | ||
bikamani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Modules = new ModulesClient(); | ||
| Statistics = new StatisticsClient(); | ||
| Messages = new CloudToDeviceMessagesClient(); | ||
| Files = new FilesClient(); | ||
| Jobs = new JobsClient(); | ||
| } | ||
| } | ||
| } | ||
55 changes: 55 additions & 0 deletions
55
sdk/iot/Azure.Iot.Hub.Service/src/IoTHubServiceClientOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using Azure.Core; | ||
|
|
||
| namespace Azure.Iot.Hub.Service | ||
| { | ||
| /// <summary> | ||
| /// Options that allow configuration of requests sent to the IoTHub service. | ||
| /// </summary> | ||
| public class IoTHubServiceClientOptions : ClientOptions | ||
| { | ||
| internal const ServiceVersion LatestVersion = ServiceVersion.V2020_03_13; | ||
|
|
||
| /// <summary> | ||
| /// The versions of IoTHub Service supported by this client | ||
| /// library. | ||
| /// </summary> | ||
| public enum ServiceVersion | ||
| { | ||
| /// <summary> | ||
| /// 2020-03-13 | ||
| /// </summary> | ||
| #pragma warning disable CA1707 // Identifiers should not contain underscores | ||
| V2020_03_13 = 1 | ||
| #pragma warning restore CA1707 // Identifiers should not contain underscores | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the <see cref="ServiceVersion"/> of the service API used when | ||
| /// making requests. | ||
| /// </summary> | ||
| public ServiceVersion Version { get; } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="IoTHubServiceClientOptions"/> | ||
| /// class. | ||
| /// </summary> | ||
| public IoTHubServiceClientOptions(ServiceVersion version = LatestVersion) | ||
| { | ||
| Version = version; | ||
| } | ||
|
|
||
|
|
||
| internal string GetVersionString() | ||
| { | ||
| return Version switch | ||
| { | ||
| ServiceVersion.V2020_03_13 => "2020-03-13", | ||
| _ => throw new ArgumentException(Version.ToString()), | ||
| }; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace Azure.Iot.Hub.Service | ||
| { | ||
| /// <summary> | ||
| /// Jobs Client place holder | ||
| /// </summary> | ||
| public class JobsClient | ||
| { | ||
| /// <summary> | ||
| /// place holder | ||
| /// </summary> | ||
| #pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| public JobsClient() | ||
| #pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| { | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace Azure.Iot.Hub.Service | ||
| { | ||
| /// <summary> | ||
| /// Modules Client place holder | ||
| /// </summary> | ||
| public class ModulesClient | ||
| { | ||
| /// <summary> | ||
| /// place holder | ||
| /// </summary> | ||
| #pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| public ModulesClient() | ||
| #pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| { | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace Azure.Iot.Hub.Service | ||
| { | ||
| /// <summary> | ||
| /// Statistics Client place holder | ||
| /// </summary> | ||
| public class StatisticsClient | ||
| { | ||
| /// <summary> | ||
| /// place holder | ||
| /// </summary> | ||
| #pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| public StatisticsClient() | ||
| #pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service. | ||
| { | ||
|
|
||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not going to have query at this level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good one to discuss. We decided CL grouping for twins under Devices and Modules as per onenote. Do we want to keep Query as a separate client instead?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that is right - groupings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well query spans over several areas i.e not just twins but also jobs and also raw queries. What about those?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jobs queries are under jobs grouping. I believe you are talking about this ones: https://github.com/Azure/azure-sdk-for-net/blob/feature/IoT-Hub/sdk/iot/Azure.Iot.Hub.Service/src/swagger/iothubservice_modified.json#L1342
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed later if this approach we decided does not work well. We thought Query for each individual sub client would be more discoverable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is raw queries?