public void CloudFileClientListSharesSegmentedAPM() { string name = GetRandomShareName(); List <string> shareNames = new List <string>(); CloudFileClient fileClient = GenerateCloudFileClient(); for (int i = 0; i < 3; i++) { string shareName = name + i.ToString(); shareNames.Add(shareName); fileClient.GetShareReference(shareName).Create(); } List <string> listedShareNames = new List <string>(); FileContinuationToken token = null; using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result; do { result = fileClient.BeginListSharesSegmented(token, ar => waitHandle.Set(), null); waitHandle.WaitOne(); ShareResultSegment resultSegment = fileClient.EndListSharesSegmented(result); token = resultSegment.ContinuationToken; foreach (CloudFileShare share in resultSegment.Results) { listedShareNames.Add(share.Name); } }while (token != null); foreach (string shareName in listedShareNames) { if (shareNames.Remove(shareName)) { fileClient.GetShareReference(shareName).Delete(); } } Assert.AreEqual(0, shareNames.Count); } }
public void CloudFileClientListSharesSegmentedContinuationTokenTask() { int shareCount = 3; string shareNamePrefix = GetRandomShareName(); List <string> shareNames = new List <string>(shareCount); CloudFileClient fileClient = GenerateCloudFileClient(); FileContinuationToken continuationToken = null; try { for (int i = 0; i < shareCount; ++i) { string shareName = shareNamePrefix + i.ToString(); shareNames.Add(shareName); fileClient.GetShareReference(shareName).CreateAsync().Wait(); } int totalCount = 0; do { ShareResultSegment resultSegment = fileClient.ListSharesSegmentedAsync(continuationToken).Result; continuationToken = resultSegment.ContinuationToken; foreach (CloudFileShare share in resultSegment.Results) { if (shareNames.Contains(share.Name)) { ++totalCount; } } }while (continuationToken != null); Assert.AreEqual(shareCount, totalCount); } finally { foreach (string shareName in shareNames) { fileClient.GetShareReference(shareName).DeleteAsync().Wait(); } } }
/// <summary> /// Core implementation of the ListFilesAndDirectories method. /// </summary> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="options">An object that specifies additional options for the request.</param> /// <param name="currentToken">The continuation token.</param> /// <returns>A <see cref="RESTCommand"/> that lists the files.</returns> private RESTCommand <ResultSegment <IListFileItem> > ListFilesAndDirectoriesImpl(int?maxResults, FileRequestOptions options, FileContinuationToken currentToken) { FileListingContext listingContext = new FileListingContext(maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand <ResultSegment <IListFileItem> > getCmd = new RESTCommand <ResultSegment <IListFileItem> >(this.ServiceClient.Credentials, this.StorageUri); options.ApplyToStorageCommand(getCmd); getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken); getCmd.RetrieveResponseStream = true; getCmd.Handler = this.ServiceClient.AuthenticationHandler; getCmd.BuildClient = HttpClientFactory.BuildHttpClient; getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => DirectoryHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, cnt, ctx); getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex); getCmd.PostProcessResponse = (cmd, resp, ctx) => { return(Task.Factory.StartNew(() => { ListFilesAndDirectoriesResponse listFilesResponse = new ListFilesAndDirectoriesResponse(cmd.ResponseStream); List <IListFileItem> fileList = listFilesResponse.Files.Select(item => this.SelectListFileItem(item)).ToList(); FileContinuationToken continuationToken = null; if (listFilesResponse.NextMarker != null) { continuationToken = new FileContinuationToken() { NextMarker = listFilesResponse.NextMarker, TargetLocation = cmd.CurrentResult.TargetLocation, }; } return new ResultSegment <IListFileItem>(fileList) { ContinuationToken = continuationToken, }; })); }; return(getCmd); }
public async Task CloudFileClientListSharesSegmentedAsync() { string name = GetRandomShareName(); List <string> shareNames = new List <string>(); DelegatingHandlerImpl delegatingHandlerImpl = new DelegatingHandlerImpl(new DelegatingHandlerImpl()); CloudFileClient fileClient = GenerateCloudFileClient(delegatingHandlerImpl); for (int i = 0; i < 3; i++) { string shareName = name + i.ToString(); shareNames.Add(shareName); await fileClient.GetShareReference(shareName).CreateAsync(); } List <string> listedShareNames = new List <string>(); FileContinuationToken token = null; do { ShareResultSegment resultSegment = await fileClient.ListSharesSegmentedAsync(token); token = resultSegment.ContinuationToken; foreach (CloudFileShare share in resultSegment.Results) { Assert.IsTrue(fileClient.GetShareReference(share.Name).StorageUri.Equals(share.StorageUri)); listedShareNames.Add(share.Name); } }while (token != null); foreach (string shareName in listedShareNames) { if (shareNames.Remove(shareName)) { await fileClient.GetShareReference(shareName).DeleteAsync(); } } Assert.AreEqual(0, shareNames.Count); Assert.AreNotEqual(0, delegatingHandlerImpl.CallCount); }
/// <summary> /// Core implementation for the ListShares method. /// </summary> /// <param name="prefix">The share prefix.</param> /// <param name="detailsIncluded">The details included.</param> /// <param name="currentToken">The continuation token.</param> /// <param name="pagination">The pagination.</param> /// <param name="setResult">The result report delegate.</param> /// <returns>A <see cref="TaskSequence"/> that lists the shares.</returns> private RESTCommand <ResultSegment <CloudFileShare> > ListSharesImpl(string prefix, ShareListingDetails detailsIncluded, FileContinuationToken currentToken, int?maxResults, FileRequestOptions options) { ListingContext listingContext = new ListingContext(prefix, maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand <ResultSegment <CloudFileShare> > getCmd = new RESTCommand <ResultSegment <CloudFileShare> >(this.Credentials, this.StorageUri); options.ApplyToStorageCommand(getCmd); getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken); getCmd.RetrieveResponseStream = true; getCmd.Handler = this.AuthenticationHandler; getCmd.BuildClient = HttpClientFactory.BuildHttpClient; getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => ShareHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, detailsIncluded, cnt, ctx); getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null, cmd, ex); getCmd.PostProcessResponse = (cmd, resp, ctx) => { return(Task.Factory.StartNew(() => { ListSharesResponse listSharesResponse = new ListSharesResponse(cmd.ResponseStream); List <CloudFileShare> sharesList = listSharesResponse.Shares.Select(item => new CloudFileShare(item.Properties, item.Metadata, item.Name, this)).ToList(); FileContinuationToken continuationToken = null; if (listSharesResponse.NextMarker != null) { continuationToken = new FileContinuationToken() { NextMarker = listSharesResponse.NextMarker, TargetLocation = cmd.CurrentResult.TargetLocation, }; } return new ResultSegment <CloudFileShare>(sharesList) { ContinuationToken = continuationToken, }; })); }; return(getCmd); }
public void CloudFileClientListSharesSegmented() { AssertSecondaryEndpoint(); string name = GetRandomShareName(); List <string> shareNames = new List <string>(); CloudFileClient fileClient = GenerateCloudFileClient(); for (int i = 0; i < 3; i++) { string shareName = name + i.ToString(); shareNames.Add(shareName); fileClient.GetShareReference(shareName).Create(); } List <string> listedShareNames = new List <string>(); FileContinuationToken token = null; do { ShareResultSegment resultSegment = fileClient.ListSharesSegmented(token); token = resultSegment.ContinuationToken; foreach (CloudFileShare share in resultSegment.Results) { Assert.IsTrue(fileClient.GetShareReference(share.Name).StorageUri.Equals(share.StorageUri)); listedShareNames.Add(share.Name); } }while (token != null); foreach (string shareName in listedShareNames) { if (shareNames.Remove(shareName)) { fileClient.GetShareReference(shareName).Delete(); } } Assert.AreEqual(0, shareNames.Count); }
public async Task CloudFileClientListSharesSegmentedWithPrefixAsync() { string name = GetRandomShareName(); List <string> shareNames = new List <string>(); CloudFileClient fileClient = GenerateCloudFileClient(); for (int i = 0; i < 3; i++) { string shareName = name + i.ToString(); shareNames.Add(shareName); await fileClient.GetShareReference(shareName).CreateAsync(); } List <string> listedShareNames = new List <string>(); FileContinuationToken token = null; do { ShareResultSegment resultSegment = await fileClient.ListSharesSegmentedAsync(name, ShareListingDetails.None, 1, token, null, null); token = resultSegment.ContinuationToken; int count = 0; foreach (CloudFileShare share in resultSegment.Results) { count++; listedShareNames.Add(share.Name); } Assert.IsTrue(count <= 1); }while (token != null); Assert.AreEqual(shareNames.Count, listedShareNames.Count); foreach (string shareName in listedShareNames) { Assert.IsTrue(shareNames.Remove(shareName)); await fileClient.GetShareReference(shareName).DeleteAsync(); } }
/// <summary> /// Core implementation of the ListFilesAndDirectories method. /// </summary> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="options">An object that specifies additional options for the request.</param> /// <param name="currentToken">The continuation token.</param> /// <param name="prefix">A string containing the file or directory name prefix.</param> /// <returns>A <see cref="RESTCommand"/> that lists the files.</returns> private RESTCommand <ResultSegment <IListFileItem> > ListFilesAndDirectoriesImpl(int?maxResults, FileRequestOptions options, FileContinuationToken currentToken, string prefix) { FileListingContext listingContext = new FileListingContext(maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null, Prefix = string.IsNullOrEmpty(prefix) ? null : prefix }; RESTCommand <ResultSegment <IListFileItem> > getCmd = new RESTCommand <ResultSegment <IListFileItem> >(this.ServiceClient.Credentials, this.StorageUri); options.ApplyToStorageCommand(getCmd); getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken); getCmd.RetrieveResponseStream = true; getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => DirectoryHttpRequestMessageFactory.List(uri, serverTimeout, this.Share.SnapshotTime, listingContext, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials); getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex); getCmd.PostProcessResponseAsync = async(cmd, resp, ctx, ct) => { ListFilesAndDirectoriesResponse listFilesResponse = await ListFilesAndDirectoriesResponse.ParseAsync(cmd.ResponseStream, ct).ConfigureAwait(false); List <IListFileItem> fileList = listFilesResponse.Files.Select(item => this.SelectListFileItem(item)).ToList(); FileContinuationToken continuationToken = null; if (listFilesResponse.NextMarker != null) { continuationToken = new FileContinuationToken() { NextMarker = listFilesResponse.NextMarker, TargetLocation = cmd.CurrentResult.TargetLocation, }; } return(new ResultSegment <IListFileItem>(fileList) { ContinuationToken = continuationToken, }); }; return(getCmd); }
public void CloudFileShareListFilesAndDirectoriesSegmentedAPM() { CloudFileShare share = GetRandomShareReference(); try { share.Create(); List <string> fileNames = CreateFiles(share, 3); CloudFileDirectory rootDirectory = share.GetRootDirectoryReference(); using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { FileContinuationToken token = null; do { IAsyncResult result = rootDirectory.BeginListFilesAndDirectoriesSegmented(1, token, null, null, ar => waitHandle.Set(), null); waitHandle.WaitOne(); FileResultSegment results = rootDirectory.EndListFilesAndDirectoriesSegmented(result); int count = 0; foreach (IListFileItem fileItem in results.Results) { Assert.IsInstanceOfType(fileItem, typeof(CloudFile)); Assert.IsTrue(fileNames.Remove(((CloudFile)fileItem).Name)); count++; } Assert.IsTrue(count <= 1); token = results.ContinuationToken; }while (token != null); Assert.AreEqual(0, fileNames.Count); } } finally { share.DeleteIfExists(); } }
public void CloudFileClientListSharesSegmentedTask() { string name = GetRandomShareName(); List <string> shareNames = new List <string>(); CloudFileClient fileClient = GenerateCloudFileClient(); for (int i = 0; i < 3; i++) { string shareName = name + i.ToString(); shareNames.Add(shareName); fileClient.GetShareReference(shareName).CreateAsync().Wait(); } List <string> listedShareNames = new List <string>(); FileContinuationToken token = null; do { ShareResultSegment resultSegment = fileClient.ListSharesSegmentedAsync(token).Result; token = resultSegment.ContinuationToken; foreach (CloudFileShare share in resultSegment.Results) { listedShareNames.Add(share.Name); } }while (token != null); foreach (string shareName in listedShareNames) { if (shareNames.Remove(shareName)) { fileClient.GetShareReference(shareName).DeleteAsync().Wait(); } } Assert.AreEqual(0, shareNames.Count); }
public void CloudFileClientListSharesWithPrefixSegmented2() { string name = GetRandomShareName(); List <string> shareNames = new List <string>(); CloudFileClient fileClient = GenerateCloudFileClient(); for (int i = 0; i < 3; i++) { string shareName = name + i.ToString(); shareNames.Add(shareName); fileClient.GetShareReference(shareName).Create(); } List <string> listedShareNames = new List <string>(); FileContinuationToken token = null; do { ShareResultSegment resultSegment = fileClient.ListSharesSegmented(name, token); token = resultSegment.ContinuationToken; int count = 0; foreach (CloudFileShare share in resultSegment.Results) { count++; listedShareNames.Add(share.Name); } }while (token != null); Assert.AreEqual(shareNames.Count, listedShareNames.Count); foreach (string shareName in listedShareNames) { Assert.IsTrue(shareNames.Remove(shareName)); fileClient.GetShareReference(shareName).Delete(); } Assert.AreEqual(0, shareNames.Count); }
public void FileContinuationTokenVerifyXmlWithinXml() { CloudFileShare share = GetRandomShareReference(); try { share.Create(); List<string> fileNames = CreateFiles(share, 3); CloudFileDirectory rootDirectory = share.GetRootDirectoryReference(); FileContinuationToken token = null; do { FileResultSegment results = rootDirectory.ListFilesAndDirectoriesSegmented(1, token, null, null); int count = 0; foreach (IListFileItem fileItem in results.Results) { Assert.IsInstanceOfType(fileItem, typeof(CloudFile)); Assert.IsTrue(fileNames.Remove(((CloudFile)fileItem).Name)); count++; } Assert.IsTrue(count <= 1); token = results.ContinuationToken; if (token != null) { Assert.AreEqual(null, token.GetSchema()); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; StringBuilder sb = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(sb, settings)) { writer.WriteStartElement("test1"); writer.WriteStartElement("test2"); token.WriteXml(writer); writer.WriteEndElement(); writer.WriteEndElement(); } using (XmlReader reader = XmlReader.Create(new StringReader(sb.ToString()))) { token = new FileContinuationToken(); reader.ReadStartElement(); reader.ReadStartElement(); token.ReadXml(reader); reader.ReadEndElement(); reader.ReadEndElement(); } } } while (token != null); Assert.AreEqual(0, fileNames.Count); } finally { share.DeleteIfExists(); } }
public IAsyncOperation<ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken) #endif { return this.ListSharesSegmentedAsync(null, ShareListingDetails.None, null, currentToken, null, null); }
/// <summary> /// Core implementation for the ListShares method. /// </summary> /// <param name="prefix">The share prefix.</param> /// <param name="detailsIncluded">The details included.</param> /// <param name="currentToken">The continuation token.</param> /// <param name="pagination">The pagination.</param> /// <param name="setResult">The result report delegate.</param> /// <returns>A <see cref="TaskSequence"/> that lists the shares.</returns> private RESTCommand<ResultSegment<CloudFileShare>> ListSharesImpl(string prefix, ShareListingDetails detailsIncluded, FileContinuationToken currentToken, int? maxResults, FileRequestOptions options) { ListingContext listingContext = new ListingContext(prefix, maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand<ResultSegment<CloudFileShare>> getCmd = new RESTCommand<ResultSegment<CloudFileShare>>(this.Credentials, this.StorageUri); options.ApplyToStorageCommand(getCmd); getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken); getCmd.RetrieveResponseStream = true; getCmd.Handler = this.AuthenticationHandler; getCmd.BuildClient = HttpClientFactory.BuildHttpClient; getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => ShareHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, detailsIncluded, cnt, ctx); getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null, cmd, ex); getCmd.PostProcessResponse = (cmd, resp, ctx) => { return Task.Factory.StartNew(() => { ListSharesResponse listSharesResponse = new ListSharesResponse(cmd.ResponseStream); List<CloudFileShare> sharesList = listSharesResponse.Shares.Select(item => new CloudFileShare(item.Properties, item.Metadata, item.Name, this)).ToList(); FileContinuationToken continuationToken = null; if (listSharesResponse.NextMarker != null) { continuationToken = new FileContinuationToken() { NextMarker = listSharesResponse.NextMarker, TargetLocation = cmd.CurrentResult.TargetLocation, }; } return new ResultSegment<CloudFileShare>(sharesList) { ContinuationToken = continuationToken, }; }); }; return getCmd; }
public Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return this.ListSharesSegmentedAsync(prefix, detailsIncluded, maxResults, currentToken, options, operationContext, CancellationToken.None); }
internal ShareResultSegment(IEnumerable<CloudFileShare> shares, FileContinuationToken continuationToken) { this.Results = shares; this.ContinuationToken = continuationToken; }
public IAsyncOperation<ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken) { return this.ListSharesSegmentedAsync(prefix, ShareListingDetails.None, null, currentToken, null, null); }
/// <summary> /// Core implementation of the ListFilesAndDirectories method. /// </summary> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="options">An object that specifies additional options for the request.</param> /// <param name="currentToken">The continuation token.</param> /// <returns>A <see cref="RESTCommand"/> that lists the files.</returns> private RESTCommand<ResultSegment<IListFileItem>> ListFilesAndDirectoriesImpl(int? maxResults, FileRequestOptions options, FileContinuationToken currentToken) { FileListingContext listingContext = new FileListingContext(maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand<ResultSegment<IListFileItem>> getCmd = new RESTCommand<ResultSegment<IListFileItem>>(this.ServiceClient.Credentials, this.StorageUri); options.ApplyToStorageCommand(getCmd); getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken); getCmd.RetrieveResponseStream = true; getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => DirectoryHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials); getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex); getCmd.PostProcessResponse = (cmd, resp, ctx) => { return Task.Factory.StartNew(() => { ListFilesAndDirectoriesResponse listFilesResponse = new ListFilesAndDirectoriesResponse(cmd.ResponseStream); List<IListFileItem> fileList = listFilesResponse.Files.Select(item => this.SelectListFileItem(item)).ToList(); FileContinuationToken continuationToken = null; if (listFilesResponse.NextMarker != null) { continuationToken = new FileContinuationToken() { NextMarker = listFilesResponse.NextMarker, TargetLocation = cmd.CurrentResult.TargetLocation, }; } return new ResultSegment<IListFileItem>(fileList) { ContinuationToken = continuationToken, }; }); }; return getCmd; }
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken) { return this.ListSharesSegmentedAsync(null, ShareListingDetails.None, null, currentToken, null, null); }
public Task<ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken) { return this.ListSharesSegmentedAsync(currentToken, CancellationToken.None); }
public ShareResultSegment ListSharesSegmented(FileContinuationToken currentToken) { return this.ListSharesSegmented(null, ShareListingDetails.None, null, currentToken, null, null); }
public virtual ICancellableAsyncResult BeginListFilesAndDirectoriesSegmented(int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this.ServiceClient); return Executor.BeginExecuteAsync( this.ListFilesAndDirectoriesImpl(maxResults, modifiedOptions, currentToken), modifiedOptions.RetryPolicy, operationContext, callback, state); }
public virtual ICancellableAsyncResult BeginListFilesAndDirectoriesSegmented(FileContinuationToken currentToken, AsyncCallback callback, object state) { return this.BeginListFilesAndDirectoriesSegmented(null /* maxResults */, currentToken, null /* options */, null /* operationContext */, callback, state); }
/// <summary> /// Returns a result segment containing a collection of file items /// in the share. /// </summary> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="currentToken">A continuation token returned by a previous listing operation.</param> /// <param name="options">An <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A result segment containing objects that implement <see cref="IListFileItem"/>.</returns> private ResultSegment<IListFileItem> ListFilesAndDirectoriesSegmentedCore(int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return Executor.ExecuteSync( this.ListFilesAndDirectoriesImpl(maxResults, options, currentToken), options.RetryPolicy, operationContext); }
public virtual FileResultSegment ListFilesAndDirectoriesSegmented(int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this.ServiceClient); ResultSegment<IListFileItem> resultSegment = this.ListFilesAndDirectoriesSegmentedCore(maxResults, currentToken, modifiedOptions, operationContext); return new FileResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken); }
public virtual Task<FileResultSegment> ListFilesAndDirectoriesSegmentedAsync(int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return AsyncExtensions.TaskFromApm(this.BeginListFilesAndDirectoriesSegmented, this.EndListFilesAndDirectoriesSegmented, maxResults, currentToken, options, operationContext, cancellationToken); }
public virtual Task<FileResultSegment> ListFilesAndDirectoriesSegmentedAsync(int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return this.ListFilesAndDirectoriesSegmentedAsync(maxResults, currentToken, options, operationContext, CancellationToken.None); }
public ShareResultSegment(IEnumerable <CloudFileShare> shares, FileContinuationToken continuationToken) { throw new System.NotImplementedException(); }
public virtual Task<FileResultSegment> ListFilesAndDirectoriesSegmentedAsync(FileContinuationToken currentToken) { return this.ListFilesAndDirectoriesSegmentedAsync(currentToken, CancellationToken.None); }
public virtual ShareResultSegment ListSharesSegmented(string prefix, FileContinuationToken currentToken) { return this.ListSharesSegmented(prefix, ShareListingDetails.None, null, currentToken, null, null); }
public virtual async Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); ResultSegment <CloudFileShare> resultSegment = await Executor.ExecuteAsync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, cancellationToken).ConfigureAwait(false); return(new ShareResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken)); }
public virtual ShareResultSegment ListSharesSegmented(FileContinuationToken currentToken) { return(this.ListSharesSegmented(null, ShareListingDetails.None, null, currentToken, null, null)); }
public async Task CloudFileListSharesWithSnapshotAsync() { CloudFileShare share = GetRandomShareReference(); await share.CreateAsync(); share.Metadata["key1"] = "value1"; await share.SetMetadataAsync(); CloudFileShare snapshot = await share.SnapshotAsync(); share.Metadata["key2"] = "value2"; await share.SetMetadataAsync(); CloudFileClient client = GenerateCloudFileClient(); List <CloudFileShare> listedShares = new List <CloudFileShare>(); FileContinuationToken token = null; do { ShareResultSegment resultSegment = await client.ListSharesSegmentedAsync(share.Name, ShareListingDetails.All, null, token, null, null); token = resultSegment.ContinuationToken; foreach (CloudFileShare listResultShare in resultSegment.Results) { listedShares.Add(listResultShare); } }while (token != null); int count = 0; bool originalFound = false; bool snapshotFound = false; foreach (CloudFileShare listShareItem in listedShares) { if (listShareItem.Name.Equals(share.Name) && !listShareItem.IsSnapshot && !originalFound) { count++; originalFound = true; Assert.AreEqual(2, listShareItem.Metadata.Count); Assert.AreEqual("value2", listShareItem.Metadata["key2"]); Assert.AreEqual("value1", listShareItem.Metadata["key1"]); Assert.AreEqual(share.StorageUri, listShareItem.StorageUri); } else if (listShareItem.Name.Equals(share.Name) && listShareItem.IsSnapshot && !snapshotFound) { count++; snapshotFound = true; Assert.AreEqual(1, listShareItem.Metadata.Count); Assert.AreEqual("value1", listShareItem.Metadata["key1"]); Assert.AreEqual(snapshot.StorageUri, listShareItem.StorageUri); } } Assert.AreEqual(2, count); await snapshot.DeleteAsync(); await share.DeleteAsync(); }
public ShareResultSegment ListSharesSegmented(string prefix, FileContinuationToken currentToken) { return(this.ListSharesSegmented(prefix, ShareListingDetails.None, null, currentToken, null, null)); }
public Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return Task.Run(async () => { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); ResultSegment<CloudFileShare> resultSegment = await Executor.ExecuteAsync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, cancellationToken); return new ShareResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken); }, cancellationToken); }
/// <summary> /// Returns a result segment containing a collection of shares /// whose names begin with the specified prefix. /// </summary> /// <param name="prefix">The share name prefix.</param> /// <param name="detailsIncluded">A value that indicates whether to return share metadata with the listing.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned /// in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="currentToken">A continuation token returned by a previous listing operation.</param> /// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A result segment of shares.</returns> private ResultSegment <CloudFileShare> ListSharesSegmentedCore(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return(Executor.ExecuteSync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, options), options.RetryPolicy, operationContext)); }
public Task<ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken)
public ICancellableAsyncResult BeginListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); return(Executor.BeginExecuteAsync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, callback, state)); }
public Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken, CancellationToken cancellationToken) { return(AsyncExtensions.TaskFromApm(this.BeginListSharesSegmented, this.EndListSharesSegmented, prefix, currentToken, cancellationToken)); }
public Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return(AsyncExtensions.TaskFromApm(this.BeginListSharesSegmented, this.EndListSharesSegmented, prefix, detailsIncluded, maxResults, currentToken, options, operationContext, cancellationToken)); }
public virtual ShareResultSegment ListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options = null, OperationContext operationContext = null) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); ResultSegment<CloudFileShare> resultSegment = this.ListSharesSegmentedCore(prefix, detailsIncluded, maxResults, currentToken, modifiedOptions, operationContext); return new ShareResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken); }
public virtual Task<FileResultSegment> ListFilesAndDirectoriesSegmentedAsync(FileContinuationToken currentToken, CancellationToken cancellationToken) { return AsyncExtensions.TaskFromApm(this.BeginListFilesAndDirectoriesSegmented, this.EndListFilesAndDirectoriesSegmented, currentToken, cancellationToken); }
public virtual Task <ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken) { return(this.ListSharesSegmentedAsync(currentToken, CancellationToken.None)); }
/// <summary> /// Returns a result segment containing a collection of shares /// whose names begin with the specified prefix. /// </summary> /// <param name="prefix">The share name prefix.</param> /// <param name="detailsIncluded">A value that indicates whether to return share metadata with the listing.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned /// in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="currentToken">A continuation token returned by a previous listing operation.</param> /// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A result segment of shares.</returns> private ResultSegment<CloudFileShare> ListSharesSegmentedCore(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return Executor.ExecuteSync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, options), options.RetryPolicy, operationContext); }
public ShareResultSegment ListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options = null, OperationContext operationContext = null) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); ResultSegment <CloudFileShare> resultSegment = this.ListSharesSegmentedCore(prefix, detailsIncluded, maxResults, currentToken, modifiedOptions, operationContext); return(new ShareResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken)); }
public virtual ICancellableAsyncResult BeginListSharesSegmented(string prefix, FileContinuationToken currentToken, AsyncCallback callback, object state) { return this.BeginListSharesSegmented(prefix, ShareListingDetails.None, null, currentToken, null, null, callback, state); }
public ICancellableAsyncResult BeginListSharesSegmented(string prefix, FileContinuationToken currentToken, AsyncCallback callback, object state) { return(this.BeginListSharesSegmented(prefix, ShareListingDetails.None, null, currentToken, null, null, callback, state)); }
public virtual ICancellableAsyncResult BeginListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); return Executor.BeginExecuteAsync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, callback, state); }
public Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken) { return(this.ListSharesSegmentedAsync(prefix, currentToken, CancellationToken.None)); }
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken) { return this.ListSharesSegmentedAsync(prefix, currentToken, CancellationToken.None); }
public Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return(this.ListSharesSegmentedAsync(prefix, detailsIncluded, maxResults, currentToken, options, operationContext, CancellationToken.None)); }
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken, CancellationToken cancellationToken) { return AsyncExtensions.TaskFromApm(this.BeginListSharesSegmented, this.EndListSharesSegmented, prefix, currentToken, cancellationToken); }
public virtual Task<FileResultSegment> ListFilesAndDirectoriesSegmentedAsync(FileContinuationToken currentToken) { return this.ListFilesAndDirectoriesSegmentedAsync(null /* maxResults */, currentToken, null /* options */, null /* operationContext */); }
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return AsyncExtensions.TaskFromApm(this.BeginListSharesSegmented, this.EndListSharesSegmented, prefix, detailsIncluded, maxResults, currentToken, options, operationContext, cancellationToken); }
public virtual Task<FileResultSegment> ListFilesAndDirectoriesSegmentedAsync(int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this.ServiceClient); return Task.Run(async () => { ResultSegment<IListFileItem> resultSegment = await Executor.ExecuteAsync( this.ListFilesAndDirectoriesImpl(maxResults, modifiedOptions, currentToken), modifiedOptions.RetryPolicy, operationContext, cancellationToken); return new FileResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken); }, cancellationToken); }
public virtual ICancellableAsyncResult BeginListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); return(CancellableAsyncResultTaskWrapper.Create(token => this.ListSharesSegmentedAsync(prefix, detailsIncluded, maxResults, currentToken, modifiedOptions, operationContext), callback, state)); }
public IAsyncOperation <ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return(AsyncInfo.Run(async(token) => { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); ResultSegment <CloudFileShare> resultSegment = await Executor.ExecuteAsync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, token); return new ShareResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken); })); }
public virtual Task <ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken, CancellationToken cancellationToken) { return(ListSharesSegmentedAsync(default(string) /*prefix*/, currentToken, cancellationToken)); }
public IAsyncOperation <ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken) { return(this.ListSharesSegmentedAsync(prefix, ShareListingDetails.None, null, currentToken, null, null)); }
public virtual Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken, CancellationToken cancellationToken) { return(this.ListSharesSegmentedAsync(prefix, default(ShareListingDetails), default(int?) /*maxResults*/, currentToken, default(FileRequestOptions), default(OperationContext), cancellationToken)); }