コード例 #1
0
        /// <summary>
        /// Create Replication Plan: Utility call
        /// </summary>
        private void CreateRecoveryPlan(string recoveryPlanName, CreateRecoveryPlanInput createRecoveryPlanInput)
        {
            LongRunningOperationResponse response =
                RecoveryServicesClient.CreateAzureSiteRecoveryRecoveryPlan(recoveryPlanName, createRecoveryPlanInput);

            JobResponse jobResponse =
                RecoveryServicesClient
                .GetAzureSiteRecoveryJobDetails(PSRecoveryServicesClient.GetJobIdFromReponseLocation(response.Location));

            WriteObject(new ASRJob(jobResponse.Job));
        }
コード例 #2
0
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            try
            {
                string recoveryPlanXml = FileUtilities.DataStore.ReadFileAsText(this.File);
                this.jobResponse = RecoveryServicesClient.CreateAzureSiteRecoveryRecoveryPlan(
                    recoveryPlanXml);
                this.WriteJob(this.jobResponse.Job);

                if (this.WaitForCompletion.IsPresent)
                {
                    this.WaitForJobCompletion(this.jobResponse.Job.ID);
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            try
            {
                this.WriteWarningWithTimestamp(
                    string.Format(
                        Properties.Resources.CmdletWillBeDeprecatedSoon,
                        this.MyInvocation.MyCommand.Name));

                string recoveryPlanXml = FileUtilities.DataStore.ReadFileAsText(this.File);
                this.jobResponse = RecoveryServicesClient.CreateAzureSiteRecoveryRecoveryPlan(
                    recoveryPlanXml);
                this.WriteJob(this.jobResponse.Job);

                if (this.WaitForCompletion.IsPresent)
                {
                    this.WaitForJobCompletion(this.jobResponse.Job.ID);
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }