Exemple #1
0
        /// <summary>
        /// Lists recovery points from Secondary region for CRR
        /// </summary>
        /// <param name="containerName">Name of the container which the item belongs to</param>
        /// <param name="protectedItemName">Name of the item</param>
        /// <param name="queryFilter">Query filter</param>
        /// <returns>List of recovery points</returns>
        public List <CrrModel.RecoveryPointResource> GetRecoveryPointsFromSecondaryRegion(
            string containerName,
            string protectedItemName,
            ODataQuery <CrrModel.BMSRPQueryObject> queryFilter,
            string vaultName         = null,
            string resourceGroupName = null)
        {
            Func <RestAzureNS.IPage <CrrModel.RecoveryPointResource> > listAsync =
                () => CrrAdapter.Client.RecoveryPointsCrr.ListWithHttpMessagesAsync(
                    vaultName ?? BmsAdapter.GetResourceName(),
                    resourceGroupName ?? BmsAdapter.GetResourceGroupName(),
                    AzureFabricName,
                    containerName,
                    protectedItemName,
                    queryFilter,
                    cancellationToken: BmsAdapter.CmdletCancellationToken).Result.Body;

            Func <string, RestAzureNS.IPage <CrrModel.RecoveryPointResource> > listNextAsync =
                nextLink => CrrAdapter.Client.RecoveryPointsCrr.ListNextWithHttpMessagesAsync(
                    nextLink,
                    cancellationToken: BmsAdapter.CmdletCancellationToken).Result.Body;

            var response = HelperUtils.GetPagedListCrr(listAsync, listNextAsync);

            return(response);
        }
Exemple #2
0
        public List <CrrModel.JobResource> GetCrrJobs(string vaultId,
                                                      string jobId,
                                                      string status,
                                                      string operation,
                                                      DateTime startTime,
                                                      DateTime endTime,
                                                      string backupManagementType,
                                                      string azureRegion = null)
        {
            ODataQuery <CrrModel.JobQueryObject> queryFilter = GetQueryObjectCrr(
                backupManagementType,
                startTime,
                endTime,
                jobId,
                status,
                operation);

            CrrModel.CrrJobRequest crrJobRequest = new CrrModel.CrrJobRequest();
            crrJobRequest.ResourceId = vaultId;

            Func <RestAzureNS.IPage <CrrModel.JobResource> > listAsync =
                () => CrrAdapter.Client.BackupCrrJobs.ListWithHttpMessagesAsync(azureRegion, crrJobRequest, queryFilter, cancellationToken: BmsAdapter.CmdletCancellationToken).Result.Body;

            Func <string, RestAzureNS.IPage <CrrModel.JobResource> > listNextAsync =
                nextLink => CrrAdapter.Client.BackupCrrJobs.ListNextWithHttpMessagesAsync(
                    nextLink,
                    cancellationToken: BmsAdapter.CmdletCancellationToken).Result.Body;

            return(HelperUtils.GetPagedListCrr(listAsync, listNextAsync));
        }
Exemple #3
0
        /// <summary>
        /// List protected items protected from secondary region by the Recovery Services vault according to the query params
        /// and pagination params.
        /// </summary>
        /// <param name="queryFilter">Query params</param>
        /// <param name="skipToken">Skip token used for pagination</param>
        /// <returns>List of protected items</returns>
        public List <CrrModel.ProtectedItemResource> ListProtectedItemCrr(
            ODataQuery <CrrModel.ProtectedItemQueryObject> queryFilter,
            string skipToken         = default(string),
            string vaultName         = null,
            string resourceGroupName = null)
        {
            Func <RestAzureNS.IPage <CrrModel.ProtectedItemResource> > listAsync =
                () => CrrAdapter.Client.BackupProtectedItemsCrr.ListWithHttpMessagesAsync(
                    vaultName ?? BmsAdapter.GetResourceName(),
                    resourceGroupName ?? BmsAdapter.GetResourceGroupName(),
                    queryFilter,
                    skipToken,
                    cancellationToken: CrrAdapter.CmdletCancellationToken).Result.Body;

            Func <string, RestAzureNS.IPage <CrrModel.ProtectedItemResource> > listNextAsync =
                nextLink => CrrAdapter.Client.BackupProtectedItemsCrr.ListNextWithHttpMessagesAsync(
                    nextLink,
                    cancellationToken: CrrAdapter.CmdletCancellationToken).Result.Body;

            var result = HelperUtils.GetPagedListCrr(listAsync, listNextAsync);

            return(result);
        }