private RESTCommand <FileServiceProperties> GetServicePropertiesImpl(FileRequestOptions requestOptions) { RESTCommand <FileServiceProperties> retCmd = new RESTCommand <FileServiceProperties>(this.Credentials, this.StorageUri, this.HttpClient); retCmd.CommandLocationMode = CommandLocationMode.PrimaryOrSecondary; retCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => FileHttpRequestMessageFactory.GetServiceProperties(uri, serverTimeout, ctx, this.GetCanonicalizer(), this.Credentials); retCmd.RetrieveResponseStream = true; retCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex); retCmd.PostProcessResponseAsync = (cmd, resp, ctx, ct) => FileHttpResponseParsers.ReadServicePropertiesAsync(cmd.ResponseStream, ct); requestOptions.ApplyToStorageCommand(retCmd); return(retCmd); }
private RESTCommand <FileServiceProperties> GetServicePropertiesImpl(FileRequestOptions requestOptions) { RESTCommand <FileServiceProperties> retCmd = new RESTCommand <FileServiceProperties>(this.Credentials, this.StorageUri); retCmd.CommandLocationMode = CommandLocationMode.PrimaryOrSecondary; retCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => FileHttpRequestMessageFactory.GetServiceProperties(uri, serverTimeout, ctx); retCmd.RetrieveResponseStream = true; retCmd.Handler = this.AuthenticationHandler; retCmd.BuildClient = HttpClientFactory.BuildHttpClient; retCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex); retCmd.PostProcessResponse = (cmd, resp, ctx) => { return(Task.Factory.StartNew(() => FileHttpResponseParsers.ReadServiceProperties(cmd.ResponseStream))); }; requestOptions.ApplyToStorageCommand(retCmd); return(retCmd); }