Пример #1
0
        ManagedDiskResource IOperationSource <ManagedDiskResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ManagedDiskData.DeserializeManagedDiskData(document.RootElement);

            return(new ManagedDiskResource(_client, data));
        }
Пример #2
0
        public async Task <Response <ManagedDiskData> > GetAsync(string subscriptionId, string resourceGroupName, string diskName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(diskName, nameof(diskName));

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

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

                value = ManagedDiskData.DeserializeManagedDiskData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }