Ejemplo n.º 1
0
        public async Task <Response <DiskRestorePointData> > GetAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (restorePointCollectionName == null)
            {
                throw new ArgumentNullException(nameof(restorePointCollectionName));
            }
            if (vmRestorePointName == null)
            {
                throw new ArgumentNullException(nameof(vmRestorePointName));
            }
            if (diskRestorePointName == null)
            {
                throw new ArgumentNullException(nameof(diskRestorePointName));
            }

            using var message = CreateGetRequest(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = DiskRestorePointData.DeserializeDiskRestorePointData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Ejemplo n.º 2
0
        public async Task <Response <DiskRestorePointData> > GetAsync(string restorePointGroupName, string subscriptionId, string resourceGroupName, string vmRestorePointName, string diskRestorePointName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(restorePointGroupName, nameof(restorePointGroupName));
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(vmRestorePointName, nameof(vmRestorePointName));
            Argument.AssertNotNullOrEmpty(diskRestorePointName, nameof(diskRestorePointName));

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

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

                value = DiskRestorePointData.DeserializeDiskRestorePointData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }