Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ASRJob" /> class with required parameters.
        /// </summary>
        /// <param name="job">ASR Job object</param>
        public ASRJob(Job job)
        {
            this.ID = job.ID;
            this.ClientRequestId = job.ActivityId;
            this.State = job.State;
            this.StateDescription = job.StateDescription;
            this.EndTime = job.EndTime;
            this.StartTime = job.StartTime;
            this.Name = job.Name;
            this.TargetObjectId = job.TargetObjectId;
            this.TargetObjectName = job.TargetObjectName;
            if (job.AllowedActions != null && job.AllowedActions.Count > 0)
            {
                this.AllowedActions = new List<string>();
                foreach (var action in job.AllowedActions)
                {
                    this.AllowedActions.Add(action);
                }
            }

            if (!string.IsNullOrEmpty(job.TargetObjectId))
            {
                this.TargetObjectType = job.TargetObjectType;
            }

            this.Tasks = new List<ASRTask>();
            foreach (var task in job.Tasks)
            {
                this.Tasks.Add(new ASRTask(task));
            }

            this.Errors = new List<ASRErrorDetails>();

            foreach (var error in job.Errors)
            {
                ASRErrorDetails errorDetails = new ASRErrorDetails();
                errorDetails.TaskId = error.TaskId;
                errorDetails.ServiceErrorDetails = new ASRServiceError(error.ServiceErrorDetails);
                errorDetails.ProviderErrorDetails = new ASRProviderError(error.ProviderErrorDetails);
                this.Errors.Add(errorDetails);
            }
        }
 /// <summary>
 /// Writes Job.
 /// </summary>
 /// <param name="job">JOB object</param>
 private void WriteJob(Microsoft.WindowsAzure.Management.SiteRecovery.Models.Job job)
 {
     this.WriteObject(new ASRJob(job));
 }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ASRJob" /> class with required parameters.
        /// </summary>
        /// <param name="job">ASR Job object</param>
        public ASRJob(Job job)
        {
            this.ID = job.ID;
            this.ClientRequestId = job.ActivityId;
            this.State = job.State;
            this.StateDescription = job.StateDescription;
            this.EndTime = job.EndTimestamp;
            this.StartTime = job.StartTimestamp;
            this.AllowedActions = job.AllowedActions as List<string>;
            this.Name = job.Name;
            this.Tasks = new List<ASRTask>();
            foreach (var task in job.Tasks)
            {
                this.Tasks.Add(new ASRTask(task));
            }

            this.Errors = new List<ASRErrorDetails>();

            foreach (var error in job.Errors)
            {
                ASRErrorDetails errorDetails = new ASRErrorDetails();
                errorDetails.TaskId = error.TaskId;
                errorDetails.ServiceErrorDetails = new ASRServiceError(error.ServiceErrorDetails);
                errorDetails.ProviderErrorDetails = new ASRProviderError(error.ProviderErrorDetails);
                this.Errors.Add(errorDetails);
            }
        }