Exemple #1
0
        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;
                }
            }
        }
        /// <summary>
        /// Gets CmdletModel of backup vault from Client model
        /// </summary>
        /// <param name="vault"></param>
        /// <param name="storage"></param>
        /// <returns></returns>
        public static CmdletModel.AzureRMBackupVault GetCmdletVault(ClientModel.AzureBackupVault vault, string storageType)
        {
            var response = new CmdletModel.AzureRMBackupVault
            {
                ResourceId = vault.Id,
                Name = vault.Name,
                Region = vault.Location,
                ResourceGroupName = GetResourceGroup(vault.Id),
                Storage = storageType,
            };

            return response;
        }
Exemple #3
0
 public ErrorInfo(Mgmt.CSMJobErrorInfo serviceErrorInfo)
 {
     this.ErrorCode = serviceErrorInfo.ErrorCode;
     this.ErrorMessage = serviceErrorInfo.ErrorString;
     this.Recommendations = new List<string>();
     foreach (string recommendation in serviceErrorInfo.Recommendations)
     {
         this.Recommendations.Add(recommendation);
     }
 }
Exemple #4
0
        // Not adding other fields because service is not filling them today.

        public AzureBackupJobSubTask(Mgmt.CSMJobTaskDetails serviceTask)
        {
            this.Name = serviceTask.TaskId;
            this.Status = serviceTask.Status;
        }
Exemple #5
0
        public AzureRMBackupJobDetails(AzureRMBackupVault vault, Mgmt.CSMJobDetailedProperties serviceJobProperties, string jobName)
            : base(vault, serviceJobProperties, jobName)
        {
            if (serviceJobProperties.PropertyBag != null)
                this.Properties = new Dictionary<string, string>(serviceJobProperties.PropertyBag);
            else
                this.Properties = new Dictionary<string, string>();

            this.SubTasks = new List<AzureBackupJobSubTask>();
            if (serviceJobProperties.TasksList != null)
            {
                foreach (Mgmt.CSMJobTaskDetails serviceSubTask in serviceJobProperties.TasksList)
                {
                    this.SubTasks.Add(new AzureBackupJobSubTask(serviceSubTask));
                }
            }
        }