Exemple #1
0
        /// <summary>
        /// Restores the disk to the secondaryRegion based on the recovery point and other input parameters
        /// </summary>
        /// <param name="rp">Recovery point to restore the disk to</param>
        /// <param name="storageAccountLocation">ID of the storage account where to restore the disk</param>
        /// <param name="triggerCRRRestoreRequest">Location of the storage account where to restore the disk</param>
        /// <param name="secondaryRegion">Type of the storage account where to restore the disk</param>
        /// <returns>Job created by this operation</returns>
        public RestAzureNS.AzureOperationResponse RestoreDiskSecondryRegion(
            AzureRecoveryPoint rp,
            CrrModel.CrossRegionRestoreRequest triggerCRRRestoreRequest,
            string storageAccountLocation = null,
            string secondaryRegion        = null)
        {
            //validation block
            if (!triggerCRRRestoreRequest.RestoreRequest.GetType().IsSubclassOf(typeof(CrrModel.AzureWorkloadRestoreRequest)))
            {
                if (storageAccountLocation != secondaryRegion)
                {
                    throw new Exception(Resources.TriggerRestoreIncorrectRegion);
                }
            }

            var response = CrrAdapter.Client.CrossRegionRestore.TriggerWithHttpMessagesAsync(secondaryRegion, triggerCRRRestoreRequest).Result;

            return(response);
        }
 /// <summary>
 /// Initializes a new instance of the CrossRegionRestoreRequestResource
 /// class.
 /// </summary>
 /// <param name="id">Resource Id represents the complete path to the
 /// resource.</param>
 /// <param name="name">Resource name associated with the
 /// resource.</param>
 /// <param name="type">Resource type represents the complete path of
 /// the form Namespace/ResourceType/ResourceType/...</param>
 /// <param name="location">Resource location.</param>
 /// <param name="tags">Resource tags.</param>
 /// <param name="eTag">Optional ETag.</param>
 /// <param name="properties">CrossRegionRestoreRequestResource
 /// properties</param>
 public CrossRegionRestoreRequestResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string eTag = default(string), CrossRegionRestoreRequest properties = default(CrossRegionRestoreRequest))
     : base(id, name, type, location, tags, eTag)
 {
     Properties = properties;
     CustomInit();
 }