/// <summary> /// Queries by Name. /// </summary> private void GetByName() { ProtectionProfileResponse profileResponse = RecoveryServicesClient.GetAzureSiteRecoveryProtectionProfile(this.Name); this.WriteProfile(profileResponse.ProtectionProfile); }
/// <summary> /// Queries all / by default. /// </summary> private void GetAll() { ProtectionProfileListResponse profileListResponse = RecoveryServicesClient.GetAzureSiteRecoveryProtectionProfile(); this.WriteProfiles(profileListResponse.ProtectionProfiles); }
/// <summary> /// Queries by Friendly name. /// </summary> private void GetByFriendlyName() { ProtectionProfileListResponse profileListResponse = RecoveryServicesClient.GetAzureSiteRecoveryProtectionProfile(); foreach (ProtectionProfile profile in profileListResponse.ProtectionProfiles) { if (0 == string.Compare(this.FriendlyName, profile.CustomData.FriendlyName, true)) { this.WriteProfile(profile); } } }
/// <summary> /// Queries by Friendly name. /// </summary> private void GetByFriendlyName() { ProtectionProfileListResponse profileListResponse = RecoveryServicesClient.GetAzureSiteRecoveryProtectionProfile(); bool found = false; foreach (ProtectionProfile profile in profileListResponse.ProtectionProfiles) { if (0 == string.Compare(this.FriendlyName, profile.CustomData.FriendlyName, true)) { this.WriteProfile(profile); found = true; } } if (!found) { throw new InvalidOperationException( string.Format( Properties.Resources.ProtectionProfileNotFound, this.FriendlyName, PSRecoveryServicesClient.asrVaultCreds.ResourceName)); } }