/// <summary> /// Get the job PS model after fetching the job object from the service given the job ID. /// </summary> /// <param name="jobId">ID of the job to be fetched</param> /// <returns></returns> public CmdletModel.JobBase GetCrrJobObject(string secondaryRegion, string vaultId, string jobId) { CrrModel.CrrJobRequest jobRequest = new CrrModel.CrrJobRequest(); jobRequest.JobName = jobId; jobRequest.ResourceId = vaultId; JobBase job = JobConversions.GetPSJobCrr(ServiceClientAdapter.GetCRRJobDetails( secondaryRegion, jobRequest)); return(job); }
public override void ExecuteCmdlet() { ExecutionBlock(() => { base.ExecuteCmdlet(); ResourceIdentifier resourceIdentifier = new ResourceIdentifier(VaultId); string vaultName = resourceIdentifier.ResourceName; string resourceGroupName = resourceIdentifier.ResourceGroupName; if (ParameterSetName == JobFilterSet) { JobId = Job.JobId; } WriteDebug("Fetching job with ID: " + JobId); if (UseSecondaryRegion.IsPresent) { CrrModel.CrrJobRequest jobRequest = new CrrModel.CrrJobRequest(); jobRequest.JobName = JobId; jobRequest.ResourceId = VaultId; // check this GetVault for rainy day scenario ARSVault vault = ServiceClientAdapter.GetVault(resourceGroupName, vaultName); string secondaryRegion = BackupUtils.regionMap[vault.Location]; CrrModel.JobResource jobDetailsCrr = ServiceClientAdapter.GetCRRJobDetails(secondaryRegion, jobRequest); WriteObject(JobConversions.GetPSJobCrr(jobDetailsCrr)); } else { JobResource jobDetails = ServiceClientAdapter.GetJob( JobId, vaultName: vaultName, resourceGroupName: resourceGroupName); WriteObject(JobConversions.GetPSJob(jobDetails)); } }); }