public static async Task <bool> SetExternalUrlAsync(this IServiceDiscoveryManager serviceDiscoveryManager, string environment, string application, Uri externalUrl)
 {
     return(await serviceDiscoveryManager.TryUpdateApplicationPropertiesAsync(
                environment,
                application,
                properties => properties.SetExternalUrl(externalUrl))
            .ConfigureAwait(false));
 }
 public static async Task <bool> RemoveFromBlacklistAsync(this IServiceDiscoveryManager serviceDiscoveryManager, string environment, string application, params Uri[] replicasToRemove)
 {
     return(await serviceDiscoveryManager.TryUpdateApplicationPropertiesAsync(
                environment,
                application,
                properties => properties.RemoveFromBlacklist(replicasToRemove))
            .ConfigureAwait(false));
 }
 /// <summary>
 /// Modifies tags by given <paramref name="replicaName"/> in the <see cref="IApplicationInfoProperties"/> of the given <paramref name="application"/> using <paramref name="modifyTagsFunc"/> and updates it in ServiceDiscovery.
 /// </summary>
 private static async Task <bool> ModifyReplicaTagsAsync(this IServiceDiscoveryManager serviceDiscoveryManager, string environment, string application, string replicaName, ReplicaTagKind replicaTagKind, Func <TagCollection, TagCollection> modifyTagsFunc)
 {
     return(await serviceDiscoveryManager.TryUpdateApplicationPropertiesAsync(
                environment,
                application,
                properties => properties.ModifyReplicaTags(replicaName, replicaTagKind, modifyTagsFunc))
            .ConfigureAwait(false));
 }
 /// <summary>
 /// Clear all tags by given <paramref name="replicaName"/> in the <see cref="IApplicationInfoProperties"/> of the given <paramref name="application"/> and updates it in ServiceDiscovery.
 /// </summary>
 private static async Task <bool> ClearReplicaTagsAsync(this IServiceDiscoveryManager serviceDiscoveryManager, string environment, string application, string replicaName, ReplicaTagKind replicaTagKind)
 {
     return(await serviceDiscoveryManager.TryUpdateApplicationPropertiesAsync(
                environment,
                application,
                properties => properties.ClearReplicaTags(replicaName, replicaTagKind))
            .ConfigureAwait(false));
 }
 /// <summary>
 /// Remove given <paramref name="tagKeys"/> by <paramref name="replicaName"/> in the <see cref="IApplicationInfoProperties"/> of the given <paramref name="application"/> and updates it in ServiceDiscovery.
 /// </summary>
 private static async Task <bool> RemoveReplicaTagsAsync(this IServiceDiscoveryManager serviceDiscoveryManager, string environment, string application, string replicaName, ReplicaTagKind replicaTagKind, IEnumerable <string> tagKeys)
 {
     return(await serviceDiscoveryManager.TryUpdateApplicationPropertiesAsync(
                environment,
                application,
                properties => properties.RemoveReplicaTags(replicaName, replicaTagKind, tagKeys))
            .ConfigureAwait(false));
 }
 public static async Task <bool> RemoveFromBlacklistAsync(this IServiceDiscoveryManager serviceDiscoveryManager, string environment, string application, params Uri[] replicasToRemove)
 {
     using (new ServiceDiscoveryEventsContextToken(builder =>
                                                   builder.SetKind(ServiceDiscoveryEventKind.ReplicaRemovedFromBlacklist)
                                                   .AddReplicas(replicasToRemove.Select(uri => uri.ToString()).ToArray())))
     {
         return(await serviceDiscoveryManager.TryUpdateApplicationPropertiesAsync(
                    environment,
                    application,
                    properties => properties.RemoveFromBlacklist(replicasToRemove))
                .ConfigureAwait(false));
     }
 }