コード例 #1
0
        /// <summary>
        ///     Creates recovery plan action custom details.
        /// </summary>
        /// <param name="objectType">Object type.</param>
        /// <param name="jObject">JSON object that will be deserialized.</param>
        /// <returns>Returns recovery plan action custom details.</returns>
        protected override RecoveryPlanActionDetails Create(
            Type objectType,
            JObject jObject)
        {
            RecoveryPlanActionDetails outputType = null;
            var actionType = (RecoveryPlanActionDetailsType)Enum.Parse(
                typeof(RecoveryPlanActionDetailsType),
                jObject.Value <string>(Constants.InstanceType));

            switch (actionType)
            {
            case RecoveryPlanActionDetailsType.AutomationRunbookActionDetails:
                outputType = new RecoveryPlanAutomationRunbookActionDetails();
                break;

            case RecoveryPlanActionDetailsType.ManualActionDetails:
                outputType = new RecoveryPlanManualActionDetails();
                break;

            case RecoveryPlanActionDetailsType.ScriptActionDetails:
                outputType = new RecoveryPlanScriptActionDetails();
                break;
            }

            return(outputType);
        }
コード例 #2
0
        getSrsRecoveryPlanAutomationRunbookActionDetails(ASRRecoveryPlanManualActionDetails automationRunbookActionDetails)
        {
            var action = new RecoveryPlanManualActionDetails();

            action.Description = automationRunbookActionDetails.Description;

            return(action);
        }
コード例 #3
0
        private static void ValidateCreateInput1(
            RecoveryPlan rp,
            string fabricId,
            string vmId)
        {
            Assert.True(rp.Properties.PrimaryFabricId == fabricId);
            Assert.True(rp.Properties.RecoveryFabricId == fabricId);

            Assert.True(rp.Properties.Groups.Count == 3);
            Assert.True(rp.Properties.Groups[0].GroupType == "Shutdown");
            Assert.True(rp.Properties.Groups[0].ReplicationProtectedItems.Count == 0);
            Assert.True(rp.Properties.Groups[1].GroupType == "Failover");
            Assert.True(rp.Properties.Groups[1].ReplicationProtectedItems.Count == 0);

            Assert.True(rp.Properties.Groups[2].GroupType == "Boot");
            Assert.True(rp.Properties.Groups[2].ReplicationProtectedItems.Count == 1);
            Assert.True(rp.Properties.Groups[2].ReplicationProtectedItems[0].Id == vmId);

            Assert.True(rp.Properties.Groups[2].StartGroupActions.Count == 1);
            Assert.True(rp.Properties.Groups[2].StartGroupActions[0].ActionName == "S1");
            Assert.True(rp.Properties.Groups[2].StartGroupActions[0].FailoverTypes.Count == 1);
            Assert.True(rp.Properties.Groups[2].StartGroupActions[0].FailoverTypes[0] == "PlannedFailover");
            Assert.True(rp.Properties.Groups[2].StartGroupActions[0].FailoverDirections.Count == 1);
            Assert.True(rp.Properties.Groups[2].StartGroupActions[0].FailoverDirections[0] == "PrimaryToRecovery");
            Assert.True(rp.Properties.Groups[2].StartGroupActions[0].CustomDetails.InstanceType == "ScriptActionDetails");

            Assert.True(rp.Properties.Groups[2].EndGroupActions.Count == 1);
            Assert.True(rp.Properties.Groups[2].EndGroupActions[0].ActionName == "M1");
            Assert.True(rp.Properties.Groups[2].EndGroupActions[0].FailoverTypes.Count == 1);
            Assert.True(rp.Properties.Groups[2].EndGroupActions[0].FailoverTypes[0] == "UnplannedFailover");
            Assert.True(rp.Properties.Groups[2].EndGroupActions[0].FailoverDirections.Count == 1);
            Assert.True(rp.Properties.Groups[2].EndGroupActions[0].FailoverDirections[0] == "RecoveryToPrimary");
            Assert.True(rp.Properties.Groups[2].EndGroupActions[0].CustomDetails.InstanceType == "ManualActionDetails");

            RecoveryPlanScriptActionDetails scriptAction =
                rp.Properties.Groups[2].StartGroupActions[0].CustomDetails as RecoveryPlanScriptActionDetails;

            Assert.True(scriptAction.Path == "path1");
            Assert.True(scriptAction.FabricLocation == "Recovery");

            RecoveryPlanManualActionDetails manualAction =
                rp.Properties.Groups[2].EndGroupActions[0].CustomDetails as RecoveryPlanManualActionDetails;

            Assert.True(manualAction.Description == "desc1");
        }
コード例 #4
0
 //
 // Summary:
 //     Initializes a new instance of the RecoveryPlanManualActionDetails class.
 public ASRRecoveryPlanManualActionDetails(RecoveryPlanManualActionDetails manualActionDetails)
 {
     this.Description = manualActionDetails.Description;
 }