Пример #1
0
        public ResponseWithHeaders <QueueCreateHeaders> Create(int?timeout = null, IDictionary <string, string> metadata = null, CancellationToken cancellationToken = default)
        {
            using var message = CreateCreateRequest(timeout, metadata);
            _pipeline.Send(message, cancellationToken);
            var headers = new QueueCreateHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 201:
            case 204:
                return(ResponseWithHeaders.FromValue(headers, message.Response));

            default:
                throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }
        public async Task <ResponseWithHeaders <QueueCreateHeaders> > CreateAsync(int?timeout = null, IDictionary <string, string> metadata = null, CancellationToken cancellationToken = default)
        {
            using var message = CreateCreateRequest(timeout, metadata);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            var headers = new QueueCreateHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 201:
            case 204:
                return(ResponseWithHeaders.FromValue(headers, message.Response));

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