Microsoft.Azure.Commands.SiteRecovery.GetAzureRmSiteRecoveryProtectionContainer.GetByFriendlyName C# (CSharp) Method

GetByFriendlyName() private method

Queries by friendly name.
private GetByFriendlyName ( ) : void
return void
        private void GetByFriendlyName()
        {
            ProtectionContainerListResponse protectionContainerListResponse;
            bool found = false;

            protectionContainerListResponse =
                RecoveryServicesClient.GetAzureSiteRecoveryProtectionContainer(this.Fabric.Name);

            foreach (
                ProtectionContainer protectionContainer in
                protectionContainerListResponse.ProtectionContainers)
            {
                if (0 == string.Compare(this.FriendlyName, protectionContainer.Properties.FriendlyName, StringComparison.OrdinalIgnoreCase))
                {
                    var protectionContainerByName = RecoveryServicesClient.GetAzureSiteRecoveryProtectionContainer(this.Fabric.Name, protectionContainer.Name).ProtectionContainer;
                    WriteProtectionContainer(protectionContainerByName);

                    found = true;
                }
            }

            if (!found)
            {
                throw new InvalidOperationException(
                    string.Format(
                    Properties.Resources.ProtectionContainerNotFound,
                    FriendlyName,
                    PSRecoveryServicesClient.asrVaultCreds.ResourceName));
            }
        }