private void GetByName()
{
ProtectionEntityListResponse protectionEntityListResponse =
RecoveryServicesClient.GetAzureSiteRecoveryProtectionEntity(
this.ProtectionContainerId);
bool found = false;
foreach (ProtectionEntity pe in protectionEntityListResponse.ProtectionEntities)
{
if (0 == string.Compare(this.Name, pe.Name, true))
{
this.WriteProtectionEntity(pe);
found = true;
}
}
if (!found)
{
throw new InvalidOperationException(
string.Format(
Properties.Resources.ProtectionEntityNotFound,
this.Name,
this.ProtectionContainerId));
}
}