/// <summary> /// Initializes a new instance of the <see cref="FileServiceClient"/> /// class. /// </summary> /// <param name="connectionString"> /// A connection string includes the authentication information /// required for your application to access data in an Azure Storage /// account at runtime. /// /// For more information, <see href="https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string"/>. /// </param> /// <param name="connectionOptions"> /// Optional connection options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> /// <remarks> /// The credentials on <paramref name="connectionString"/> will override those on <paramref name="connectionOptions"/>. /// </remarks> public FileServiceClient(string connectionString, FileConnectionOptions connectionOptions = default) { var conn = StorageConnectionString.Parse(connectionString); // TODO: perform a copy of the options instead var connOptions = connectionOptions ?? new FileConnectionOptions(); connOptions.Credentials = conn.Credentials; this.Uri = conn.FileEndpoint; this._pipeline = connOptions.Build(); }
/// <summary> /// Initializes a new instance of the <see cref="ShareClient"/> /// class. /// </summary> /// <param name="connectionString"> /// A connection string includes the authentication information /// required for your application to access data in an Azure Storage /// account at runtime. /// /// For more information, <see href="https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string"/>. /// </param> /// <param name="shareName"> /// The name of the share in the storage account to reference. /// </param> /// <param name="connectionOptions"> /// Optional connection options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> /// <remarks> /// The credentials on <paramref name="connectionString"/> will override those on <paramref name="connectionOptions"/>. /// </remarks> public ShareClient(string connectionString, string shareName, FileConnectionOptions connectionOptions = default) { var conn = StorageConnectionString.Parse(connectionString); var builder = new FileUriBuilder(conn.FileEndpoint) { ShareName = shareName }; // TODO: perform a copy of the options instead var connOptions = connectionOptions ?? new FileConnectionOptions(); connOptions.Credentials = conn.Credentials; this.Uri = builder.ToUri(); this._pipeline = connOptions.Build(); }
/// <summary> /// Initializes a new instance of the <see cref="FileServiceClient"/> /// class. /// </summary> /// <param name="primaryUri"> /// A <see cref="Uri"/> referencing the file service. /// </param> /// <param name="connectionOptions"> /// Optional connection options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> public FileServiceClient(Uri primaryUri, FileConnectionOptions connectionOptions = default) : this(primaryUri, (connectionOptions ?? new FileConnectionOptions()).Build()) { }