private void GetByFriendlyName()
{
bool found = false;
ProtectableItemListResponse protectableItemListResponse = RecoveryServicesClient.GetAzureSiteRecoveryProtectableItem(
Utilities.GetValueFromArmId(this.ProtectionContainer.ID, ARMResourceTypeConstants.ReplicationFabrics),
this.ProtectionContainer.Name);
ProtectableItem protectableItem = protectableItemListResponse.ProtectableItems.SingleOrDefault(t => string.Compare(t.Properties.FriendlyName, this.FriendlyName, StringComparison.OrdinalIgnoreCase) == 0);
if (protectableItem != null)
{
ProtectableItemResponse protectableItemResponse = RecoveryServicesClient.GetAzureSiteRecoveryProtectableItem(
Utilities.GetValueFromArmId(this.ProtectionContainer.ID, ARMResourceTypeConstants.ReplicationFabrics),
this.ProtectionContainer.Name,
protectableItem.Name);
WriteProtectionEntity(protectableItemResponse.ProtectableItem);
found = true;
}
if (!found)
{
throw new InvalidOperationException(
string.Format(
Properties.Resources.ProtectionEntityNotFound,
this.FriendlyName,
this.ProtectionContainer.FriendlyName));
}
}