/// <summary> /// ProcessRecord of the command. /// </summary> public override void ExecuteSiteRecoveryCmdlet() { base.ExecuteSiteRecoveryCmdlet(); List <StorageClassification> storageClassifications = new List <StorageClassification>(); Task storageClassificationTask = RecoveryServicesClient.EnumerateStorageClassificationsAsync((entities) => { storageClassifications.AddRange(entities); }); Task.WaitAll(storageClassificationTask); switch (this.ParameterSetName) { case ASRParameterSets.ByFriendlyName: storageClassifications = storageClassifications.Where(item => item.Properties.FriendlyName.Equals( this.FriendlyName, StringComparison.InvariantCultureIgnoreCase)) .ToList(); break; case ASRParameterSets.ByName: storageClassifications = storageClassifications.Where(item => item.Name.Equals( this.Name, StringComparison.InvariantCultureIgnoreCase)) .ToList(); break; case ASRParameterSets.ByServerObject: this.WriteWarningWithTimestamp(Properties.Resources.ParameterSetWillBeDeprecatedSoon); storageClassifications = storageClassifications.Where(item => item.GetFabricId().ToLower().Equals(this.Fabric.ID.ToLower())).ToList(); break; case ASRParameterSets.ByFabricObject: storageClassifications = storageClassifications.Where(item => item.GetFabricId().ToLower().Equals(this.Fabric.ID.ToLower())).ToList(); break; } var psObject = storageClassifications.ConvertAll(item => { return(new ASRStorageClassification() { FriendlyName = item.Properties.FriendlyName, Id = item.Id, Name = item.Name }); }); this.WriteObject(psObject, true); }