/// <summary>
        /// Implementation for the GetPermissions method.
        /// </summary>
        /// <param name="requestOptions">An object that specifies additional options for the request.</param>
        /// <returns>A <see cref="RESTCommand"/> that gets the permissions.</returns>
        private RESTCommand <TablePermissions> GetPermissionsImpl(TableRequestOptions requestOptions)
        {
            RESTCommand <TablePermissions> getCmd = new RESTCommand <TablePermissions>(this.ServiceClient.Credentials, this.Uri);

            getCmd.ApplyRequestOptions(requestOptions);
            getCmd.Handler                = this.ServiceClient.AuthenticationHandler;
            getCmd.BuildClient            = HttpClientFactory.BuildHttpClient;
            getCmd.RetrieveResponseStream = true;
            getCmd.BuildRequest           = (cmd, cnt, ctx) => TableHttpRequestMessageFactory.GetAcl(cmd.Uri, cmd.ServerTimeoutInSeconds, cnt, ctx);
            getCmd.PreProcessResponse     = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
            getCmd.PostProcessResponse    = (cmd, resp, ctx) =>
            {
                return(Task <TablePermissions> .Factory.StartNew(() =>
                {
                    TablePermissions TableAcl = new TablePermissions();
                    HttpResponseParsers.ReadSharedAccessIdentifiers(TableAcl.SharedAccessPolicies, new TableAccessPolicyResponse(cmd.ResponseStream));
                    return TableAcl;
                }));
            };

            return(getCmd);
        }
Esempio n. 2
0
 /// <summary>
 /// Reads the share access policies from a stream in XML.
 /// </summary>
 /// <param name="inputStream">The stream of XML policies.</param>
 /// <param name="permissions">The permissions object to which the policies are to be written.</param>
 public static void ReadSharedAccessIdentifiers(Stream inputStream, TablePermissions permissions)
 {
     HttpResponseParsers.ReadSharedAccessIdentifiers(permissions.SharedAccessPolicies, new TableAccessPolicyResponse(inputStream));
 }
        /// <summary>
        /// Reads the share access policies from a stream in XML.
        /// </summary>
        /// <param name="inputStream">The stream of XML policies.</param>
        /// <param name="permissions">The permissions object to which the policies are to be written.</param>
        public static void ReadSharedAccessIdentifiers(Stream inputStream, TablePermissions permissions)
        {
            CommonUtility.AssertNotNull("permissions", permissions);

            HttpResponseParsers.ReadSharedAccessIdentifiers(permissions.SharedAccessPolicies, new TableAccessPolicyResponse(inputStream));
        }