Exemple #1
0
            /// <summary>
            /// Create the Service.SubmitBatchAsync response or throw a failure exception.
            /// </summary>
            /// <param name="response">The raw Response.</param>
            /// <returns>The Service.SubmitBatchAsync Azure.Response{Azure.Storage.Blobs.Models.BlobBatchResult}.</returns>
            internal static Azure.Response <Azure.Storage.Blobs.Models.BlobBatchResult> SubmitBatchAsync_CreateResponse(
                Azure.Response response)
            {
                // Process the response
                switch (response.Status)
                {
                case 202:
                {
                    // Create the result
                    Azure.Storage.Blobs.Models.BlobBatchResult _value = new Azure.Storage.Blobs.Models.BlobBatchResult();
                    _value.Content = response.ContentStream;     // You should manually wrap with RetriableStream!

                    // Get response headers
                    string _header;
                    if (response.Headers.TryGetValue("Content-Type", out _header))
                    {
                        _value.ContentType = _header;
                    }

                    // Create the response
                    return(Response.FromValue(_value, response));
                }

                default:
                {
                    // Create the result
                    System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.Xml.Linq.LoadOptions.PreserveWhitespace);
                    Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml(_xml.Root);

                    throw _value.CreateException(response);
                }
                }
            }
Exemple #2
0
            /// <summary>
            /// Create the Blob.SetAccessTierAsync response or throw a failure exception.
            /// </summary>
            /// <param name="response">The raw Response.</param>
            /// <returns>The Blob.SetAccessTierAsync Azure.Response.</returns>
            internal static Azure.Response SetAccessTierAsync_CreateResponse(
                Azure.Response response)
            {
                // Process the response
                switch (response.Status)
                {
                case 200:
                {
                    return(response);
                }

                case 202:
                {
                    return(response);
                }

                default:
                {
                    // Create the result
                    System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.Xml.Linq.LoadOptions.PreserveWhitespace);
                    Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml(_xml.Root);

                    throw _value.CreateException(response);
                }
                }
            }