コード例 #1
0
        public async Task <ResponseWithHeaders <TableServiceProperties, ServiceGetPropertiesHeaders> > GetPropertiesAsync(int?timeout = null, string requestId = null, CancellationToken cancellationToken = default)
        {
            using var message = CreateGetPropertiesRequest(timeout, requestId);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            var headers = new ServiceGetPropertiesHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 200:
            {
                TableServiceProperties value = default;
                var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
                if (document.Element("StorageServiceProperties") is XElement storageServicePropertiesElement)
                {
                    value = TableServiceProperties.DeserializeTableServiceProperties(storageServicePropertiesElement);
                }
                return(ResponseWithHeaders.FromValue(value, headers, message.Response));
            }

            default:
                throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }