internal DiskRestorePoint(ArmResource options, DiskRestorePointData resource) : base(options, resource.Id)
 {
     HasData                     = true;
     _data                       = resource;
     _clientDiagnostics          = new ClientDiagnostics(ClientOptions);
     _diskRestorePointRestClient = new DiskRestorePointRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }
Beispiel #2
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));
            }
Beispiel #3
0
        internal DiskRestorePoint(ArmResource options, DiskRestorePointData data) : base(options, data.Id)
        {
            HasData                     = true;
            _data                       = data;
            _clientDiagnostics          = new ClientDiagnostics(ClientOptions);
            _diskRestorePointRestClient = new DiskRestorePointRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
#if DEBUG
            ValidateResourceId(Id);
#endif
        }
Beispiel #4
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));
            }
Beispiel #5
0
 internal DiskRestorePoint(ArmClient client, DiskRestorePointData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }