public AzureRMBackupJob(AzureRMBackupVault vault, Mgmt.CSMJobProperties serviceJob, string jobName) : base(vault) { this.InstanceId = jobName; this.WorkloadType = AzureBackupJobHelper.GetTypeForPS(serviceJob.WorkloadType); this.WorkloadName = serviceJob.EntityFriendlyName; this.Operation = serviceJob.Operation; this.Status = serviceJob.Status; this.Duration = serviceJob.Duration; this.StartTime = serviceJob.StartTimestamp; this.EndTime = serviceJob.EndTimestamp; this.ErrorDetails = new List <ErrorInfo>(); if (serviceJob.ErrorDetails != null) { foreach (Mgmt.CSMJobErrorInfo error in serviceJob.ErrorDetails) { this.ErrorDetails.Add(new ErrorInfo(error)); } } this.IsRetriable = this.IsCancellable = false; if (serviceJob.ActionsInfo != null) { for (int i = 0; i < serviceJob.ActionsInfo.Count; i++) { if (serviceJob.ActionsInfo[i] == Mgmt.JobSupportedAction.Cancellable) { this.IsCancellable = true; } else if (serviceJob.ActionsInfo[i] == Mgmt.JobSupportedAction.Retriable) { this.IsRetriable = true; } } } }
private void ValidateJobProperties(CSMJobProperties props) { Assert.True(props.Duration != TimeSpan.Zero, "Duration should be > 0"); Assert.True(props.EntityFriendlyName != null, "Entity friendly name shouldn't be null"); Assert.True(props.Operation != null, "Operation of the job can't be null"); Assert.True(props.Status != null, "Status can't be null"); Assert.True(props.WorkloadType != null, "WorkloadType can't be null"); Assert.True(props.StartTimestamp != DateTime.MinValue, "StartTime can't be DateTime.MinValue"); }