/// <summary>
        /// Creates a <see cref="RestClient"/> using a given <see cref="AuthenticationData"/>
        /// </summary>
        /// <param name="authenticationData">The data from which the instance will be created</param>
        public static RestClient CreateFrom(AuthenticationData authenticationData)
        {
            switch (authenticationData.Type)
            {
            case AuthenticationMethodProvider.AuthenticationType.SymmetricKey:
            {
                // Getting a specific module using REST with SAS token authentication
                string key       = AuthenticationFileUtils.GetBase64EncodedSymmetricKeyFromFile(authenticationData.FilePath);
                string keyTarget = authenticationData.Identity == AuthenticationMethodProvider.AuthenticationIdentity.Device ?
                                   authenticationData.GatewayHostName :                                               // Device Sas Token
                                   $"{authenticationData.IdScope}/registrations/{authenticationData.RegistrationId}"; // DPS Sas Token
                string sasToken   = GenerateSaSToken(key, keyTarget, TimeSpan.FromMinutes(_sasTokenTtl));
                var    restClient = new RestClient(authenticationData.GatewayHostName, sasToken);
                return(restClient);
            }

            case AuthenticationMethodProvider.AuthenticationType.SelfSignedCertificate:
            {
                X509Certificate2 cert = CertificateLoader.Load(authenticationData.CertificateLocation.Value, authenticationData.FilePath);
                var restClient        = new RestClient(authenticationData.GatewayHostName, cert);
                return(restClient);
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(authenticationData.Type), authenticationData.Type, "Unsupported authentication type");
            }
        }
        /// <summary>
        /// Returns the connection string from the configuration file
        /// </summary>
        /// <returns>Connection String</returns>
        public override string GetConnectionString()
        {
            string key = AuthenticationFileUtils.GetBase64EncodedSymmetricKeyFromFile(AuthenticationData.FilePath);

            return(CreateModuleConnectionString(AuthenticationData.GatewayHostName, AuthenticationData.DeviceId, key));
        }