Exemple #1
0
        public async Task <Response <OperationStatus> > GetAsync(string subscriptionId, string resourceGroupName, string asyncOperationId, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(asyncOperationId, nameof(asyncOperationId));

            using var message = CreateGetRequest(subscriptionId, resourceGroupName, asyncOperationId);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                OperationStatus value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = OperationStatus.DeserializeOperationStatus(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Exemple #2
0
        public async Task <Response <OperationStatus> > GetAsync(string location, string operationId, CancellationToken cancellationToken = default)
        {
            if (location == null)
            {
                throw new ArgumentNullException(nameof(location));
            }
            if (operationId == null)
            {
                throw new ArgumentNullException(nameof(operationId));
            }

            using var message = CreateGetRequest(location, operationId);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                OperationStatus value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = OperationStatus.DeserializeOperationStatus(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }