private FileSasBuilder BuildFileSasBuilder(bool includeVersion, bool includeFilePath, TestConstants constants, string shareName, string filePath) { var fileSasBuilder = new FileSasBuilder { Version = null, Protocol = constants.Sas.Protocol, StartsOn = constants.Sas.StartTime, ExpiresOn = constants.Sas.ExpiryTime, IPRange = constants.Sas.IPRange, Identifier = constants.Sas.Identifier, ShareName = shareName, FilePath = "", CacheControl = constants.Sas.CacheControl, ContentDisposition = constants.Sas.ContentDisposition, ContentEncoding = constants.Sas.ContentEncoding, ContentLanguage = constants.Sas.ContentLanguage, ContentType = constants.Sas.ContentType }; fileSasBuilder.SetPermissions(FileSasPermissions.All); if (includeVersion) { fileSasBuilder.Version = constants.Sas.Version; } if (includeFilePath) { fileSasBuilder.FilePath = filePath; } return(fileSasBuilder); }
public SasQueryParameters GetNewFileServiceSasCredentialsShare(string shareName, StorageSharedKeyCredential sharedKeyCredentials = default) { var builder = new FileSasBuilder { ShareName = shareName, Protocol = SasProtocol.None, StartsOn = Recording.UtcNow.AddHours(-1), ExpiresOn = Recording.UtcNow.AddHours(+1), IPRange = new SasIPRange(IPAddress.None, IPAddress.None) }; builder.SetPermissions(ShareSasPermissions.All); return(builder.ToSasQueryParameters(sharedKeyCredentials ?? GetNewSharedKeyCredentials())); }