From d3b46a11d383697663a657ace08baf1a1e0e5895 Mon Sep 17 00:00:00 2001 From: "David R. Williamson" Date: Wed, 26 Jan 2022 11:02:29 -0800 Subject: [PATCH] Update RegistryManager instantiation doc comments --- iothub/service/src/RegistryManager.cs | 73 +++++++++++++++------------ 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/iothub/service/src/RegistryManager.cs b/iothub/service/src/RegistryManager.cs index a92958bbcd..41121411c1 100644 --- a/iothub/service/src/RegistryManager.cs +++ b/iothub/service/src/RegistryManager.cs @@ -70,48 +70,30 @@ public class RegistryManager : IDisposable private IHttpClientHelper _httpClientHelper; /// - /// Creates an instance of , provided for unit testing purposes only. + /// Creates an instance of RegistryManager, provided for unit testing purposes only. /// Use the CreateFromConnectionString method to create an instance to use the client. /// public RegistryManager() { } - internal RegistryManager(IotHubConnectionProperties connectionProperties, HttpTransportSettings transportSettings) - { - _iotHubName = connectionProperties.IotHubName; - _httpClientHelper = new HttpClientHelper( - connectionProperties.HttpsEndpoint, - connectionProperties, - ExceptionHandlingHelper.GetDefaultErrorMapping(), - s_defaultOperationTimeout, - transportSettings.Proxy, - transportSettings.ConnectionLeaseTimeoutMilliseconds); - } - - // internal test helper - internal RegistryManager(string iotHubName, IHttpClientHelper httpClientHelper) - { - _iotHubName = iotHubName; - _httpClientHelper = httpClientHelper ?? throw new ArgumentNullException(nameof(httpClientHelper)); - } - /// /// Creates a RegistryManager from the IoT Hub connection string. /// /// The IoT Hub connection string. - /// An RegistryManager instance. + /// A RegistryManager instance. public static RegistryManager CreateFromConnectionString(string connectionString) { return CreateFromConnectionString(connectionString, new HttpTransportSettings()); } /// - /// Creates a RegistryManager from the IoT Hub connection string and transport settings + /// Creates an instance of RegistryManager, authenticating using an IoT hub connection string, and specifying + /// HTTP transport settings. /// - /// The IoT Hub connection string. + /// The IoT hub connection string. /// The HTTP transport settings. - /// An RegistryManager instance. + /// A RegistryManager instance. public static RegistryManager CreateFromConnectionString(string connectionString, HttpTransportSettings transportSettings) { if (transportSettings == null) @@ -127,15 +109,18 @@ public static RegistryManager CreateFromConnectionString(string connectionString #if !NET451 /// - /// Creates an instance of RegistryManager. + /// Creates an instance of RegistryManager, authenticating using an identity in Azure Active Directory (AAD). /// - /// IoT hub host name. - /// Azure Active Directory credentials to authenticate with IoT hub. See - /// The HTTP transport settings. - /// An instance of . /// - /// For more information on configuring IoT hub with Azure Active Directory, see + /// For more about information on the options of authenticating using a derived instance of , see + /// . + /// For more information on configuring IoT hub with Azure Active Directory, see + /// /// + /// IoT hub host name. + /// Azure Active Directory (AAD) credentials to authenticate with IoT hub. + /// The HTTP transport settings. + /// A RegistryManager instance. public static RegistryManager Create( string hostName, TokenCredential credential, @@ -156,12 +141,17 @@ public static RegistryManager Create( } /// - /// Creates an instance of . + /// Creates an instance of RegistryManager using a shared access signature provided and refreshed as necessary by the caller. /// + /// + /// Users may wish to build their own shared access signature (SAS) tokens rather than give the shared key to the SDK and let it manage signing and renewal. + /// The object gives the SDK access to the SAS token, while the caller can update it as necessary using the + /// method. + /// /// IoT hub host name. /// Credential that generates a SAS token to authenticate with IoT hub. See . /// The HTTP transport settings. - /// An instance of . + /// A RegistryManager instance. public static RegistryManager Create( string hostName, AzureSasCredential credential, @@ -183,6 +173,25 @@ public static RegistryManager Create( #endif + internal RegistryManager(IotHubConnectionProperties connectionProperties, HttpTransportSettings transportSettings) + { + _iotHubName = connectionProperties.IotHubName; + _httpClientHelper = new HttpClientHelper( + connectionProperties.HttpsEndpoint, + connectionProperties, + ExceptionHandlingHelper.GetDefaultErrorMapping(), + s_defaultOperationTimeout, + transportSettings.Proxy, + transportSettings.ConnectionLeaseTimeoutMilliseconds); + } + + // internal test helper + internal RegistryManager(string iotHubName, IHttpClientHelper httpClientHelper) + { + _iotHubName = iotHubName; + _httpClientHelper = httpClientHelper ?? throw new ArgumentNullException(nameof(httpClientHelper)); + } + /// public void Dispose() {