/// <summary>
        ///     Gets Azure Site Recovery Protection Container Mapping.
        /// </summary>
        /// <param name="fabricName">Fabric Name</param>
        /// <param name="protectionContainerName">Protection Container Name</param>
        /// <returns></returns>
        public List <ProtectionContainerMapping> GetAzureSiteRecoveryProtectionContainerMapping(
            string fabricName,
            string protectionContainerName)
        {
            var firstPage = this.GetSiteRecoveryClient()
                            .ReplicationProtectionContainerMappings
                            .ListByReplicationProtectionContainersWithHttpMessagesAsync(
                fabricName,
                protectionContainerName,
                this.GetRequestHeaders(true))
                            .GetAwaiter()
                            .GetResult()
                            .Body;
            var pages = Utilities.GetAllFurtherPages(
                this.GetSiteRecoveryClient()
                .ReplicationProtectionContainerMappings
                .ListByReplicationProtectionContainersNextWithHttpMessagesAsync,
                firstPage.NextPageLink,
                this.GetRequestHeaders(true));

            pages.Insert(
                0,
                firstPage);

            return(Utilities.IpageToList(pages));
        }
        /// <summary>
        ///     Retrieves Protected Items.
        /// </summary>
        /// <param name="recoveryPlanName">Recovery Plan Name</param>
        /// <returns>Protection entity list response</returns>
        public List <ReplicationProtectedItem> GetAzureSiteRecoveryReplicationProtectedItemInRP(
            string recoveryPlanName)
        {
            var protectedItemsQueryParameter =
                new ProtectedItemsQueryParameter {
                RecoveryPlanName = recoveryPlanName
            };
            var odataQuery =
                new ODataQuery <ProtectedItemsQueryParameter>(
                    protectedItemsQueryParameter.ToQueryString());
            var firstPage = this.GetSiteRecoveryClient()
                            .ReplicationProtectedItems.ListWithHttpMessagesAsync(
                odataQuery,
                null,
                this.GetRequestHeaders(true))
                            .GetAwaiter()
                            .GetResult()
                            .Body;

            var pages = Utilities.GetAllFurtherPages(
                this.GetSiteRecoveryClient()
                .ReplicationProtectedItems.ListNextWithHttpMessagesAsync,
                firstPage.NextPageLink,
                this.GetRequestHeaders(true));

            pages.Insert(0, firstPage);
            return(Utilities.IpageToList(pages));
        }
        /// <summary>
        ///     Gets Azure Site Recovery Fabrics.
        /// </summary>
        /// <returns>Server list response</returns>
        public List <Fabric> GetAzureSiteRecoveryFabric()
        {
            var firstPage = this.GetSiteRecoveryClient()
                            .ReplicationFabrics.ListWithHttpMessagesAsync(this.GetRequestHeaders(true))
                            .GetAwaiter()
                            .GetResult()
                            .Body;

            var pages = Utilities.GetAllFurtherPages(
                this.GetSiteRecoveryClient()
                .ReplicationFabrics.ListNextWithHttpMessagesAsync,
                firstPage.NextPageLink,
                this.GetRequestHeaders(true));

            pages.Insert(0, firstPage);
            return(Utilities.IpageToList(pages));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Gets all the Events with Event Query Params.
        /// </summary>
        /// <param name="parameters">Event Query parameters.</param>
        /// <returns>Events list response.</returns>
        public List <EventModel> ListAzureRmSiteRecoveryEvents(EventQueryParameter parameters)
        {
            var odataQuery = new ODataQuery <EventQueryParameter>(parameters.ToQueryString());
            var firstPage  = this.GetSiteRecoveryClient()
                             .ReplicationEvents
                             .ListWithHttpMessagesAsync(odataQuery, this.GetRequestHeaders(true))
                             .GetAwaiter()
                             .GetResult()
                             .Body;

            var pages = Utilities.GetAllFurtherPages(
                this.GetSiteRecoveryClient().ReplicationEvents.ListNextWithHttpMessagesAsync,
                firstPage.NextPageLink,
                this.GetRequestHeaders(true));

            pages.Insert(0, firstPage);

            return(Utilities.IpageToList(pages));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Gets all the vCenters in Fabric.
        /// </summary>
        /// <param name="fabricId">Fabric ID.</param>
        /// <returns>vCenter list response.</returns>
        public List <VCenter> ListAzureRmSiteRecoveryvCenter(string fabricId)
        {
            var firstPage = this.GetSiteRecoveryClient()
                            .ReplicationvCenters
                            .ListByReplicationFabricsWithHttpMessagesAsync(
                fabricId,
                this.GetRequestHeaders(true))
                            .GetAwaiter()
                            .GetResult()
                            .Body;
            var pages = Utilities.GetAllFurtherPages(
                this.GetSiteRecoveryClient()
                .ReplicationvCenters
                .ListByReplicationFabricsNextWithHttpMessagesAsync,
                firstPage.NextPageLink,
                this.GetRequestHeaders(true));

            pages.Insert(0, firstPage);
            return(Utilities.IpageToList(pages));
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Get Azure Site Recovery Job.
        /// </summary>
        /// <returns>Job list response</returns>
        public List <Job> GetAzureSiteRecoveryJob(
            JobQueryParameter jqp)
        {
            var odataQuery = new ODataQuery <JobQueryParameter>(jqp.ToQueryString());
            var firstPage  = this.GetSiteRecoveryClient()
                             .ReplicationJobs.ListWithHttpMessagesAsync(
                odataQuery,
                this.GetRequestHeaders(true))
                             .GetAwaiter()
                             .GetResult()
                             .Body;
            var pages = Utilities.GetAllFurtherPages(
                this.GetSiteRecoveryClient()
                .ReplicationJobs.ListNextWithHttpMessagesAsync,
                firstPage.NextPageLink,
                this.GetRequestHeaders(true));

            pages.Insert(
                0,
                firstPage);

            return(Utilities.IpageToList(pages));
        }