/// <summary> /// Implementation for the SetProperties method. /// </summary> /// <param name="accessCondition">An object that represents the access conditions for the share. If null, no condition is used.</param> /// <param name="options">An object that specifies additional options for the request.</param> /// <returns>A <see cref="RESTCommand"/> that sets the metadata.</returns> private RESTCommand <NullType> SetPropertiesImpl(AccessCondition accessCondition, FileRequestOptions options) { RESTCommand <NullType> putCmd = new RESTCommand <NullType>(this.ServiceClient.Credentials, this.StorageUri); options.ApplyToStorageCommand(putCmd); putCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => { StorageRequestMessage msg = ShareHttpRequestMessageFactory.SetProperties(uri, serverTimeout, this.Properties, accessCondition, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials); ShareHttpRequestMessageFactory.AddMetadata(msg, this.Metadata); return(msg); }; putCmd.PreProcessResponse = (cmd, resp, ex, ctx) => { HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, NullType.Value, cmd, ex); this.UpdateETagAndLastModified(resp); return(NullType.Value); }; return(putCmd); }
/// <summary> /// Implementation for the Create method. /// </summary> /// <param name="options">An object that specifies additional options for the request.</param> /// <returns>A <see cref="RESTCommand"/> that creates the share.</returns> private RESTCommand <NullType> CreateShareImpl(FileRequestOptions options) { RESTCommand <NullType> putCmd = new RESTCommand <NullType>(this.ServiceClient.Credentials, this.StorageUri); options.ApplyToStorageCommand(putCmd); putCmd.Handler = this.ServiceClient.AuthenticationHandler; putCmd.BuildClient = HttpClientFactory.BuildHttpClient; putCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => { HttpRequestMessage msg = ShareHttpRequestMessageFactory.Create(uri, serverTimeout, cnt, ctx); ShareHttpRequestMessageFactory.AddMetadata(msg, this.Metadata); return(msg); }; putCmd.PreProcessResponse = (cmd, resp, ex, ctx) => { HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Created, resp, NullType.Value, cmd, ex); this.Properties = ShareHttpResponseParsers.GetProperties(resp); this.Metadata = ShareHttpResponseParsers.GetMetadata(resp); return(NullType.Value); }; return(putCmd); }