33// See the LICENSE file in the project root for more information.
44
55using Consul ;
6+ using Consul . Filtering ;
67using Microsoft . Extensions . Logging ;
78using Microsoft . Extensions . Logging . Abstractions ;
89using Microsoft . Extensions . Options ;
@@ -130,7 +131,7 @@ public async Task<IList<IServiceInstance>> GetAllInstancesAsync(QueryOptions que
130131
131132 if ( options . Enabled )
132133 {
133- ISet < string > serviceIds = await GetServiceIdsAsync ( queryOptions , cancellationToken ) ;
134+ ISet < string > serviceIds = await GetServiceIdsAsync ( null , null , queryOptions , cancellationToken ) ;
134135
135136 foreach ( string serviceId in serviceIds )
136137 {
@@ -144,22 +145,28 @@ public async Task<IList<IServiceInstance>> GetAllInstancesAsync(QueryOptions que
144145 /// <inheritdoc />
145146 public Task < ISet < string > > GetServiceIdsAsync ( CancellationToken cancellationToken )
146147 {
147- return GetServiceIdsAsync ( QueryOptions . Default , cancellationToken ) ;
148+ return GetServiceIdsAsync ( null , null , QueryOptions . Default , cancellationToken ) ;
148149 }
149150
150151 /// <summary>
151152 /// Gets all registered service IDs from the Consul catalog.
152153 /// </summary>
154+ /// <param name="dataCenter">
155+ /// Specifies the datacenter to query.
156+ /// </param>
157+ /// <param name="filter">
158+ /// Specifies the expression used to filter the queries results prior to returning the data.
159+ /// </param>
153160 /// <param name="queryOptions">
154- /// Any Consul query options to use .
161+ /// Options to parameterize the Consul query .
155162 /// </param>
156163 /// <param name="cancellationToken">
157164 /// The token to monitor for cancellation requests.
158165 /// </param>
159166 /// <returns>
160167 /// The list of service IDs.
161168 /// </returns>
162- public async Task < ISet < string > > GetServiceIdsAsync ( QueryOptions queryOptions , CancellationToken cancellationToken )
169+ public async Task < ISet < string > > GetServiceIdsAsync ( string ? dataCenter , Filter ? filter , QueryOptions queryOptions , CancellationToken cancellationToken )
163170 {
164171 ArgumentNullException . ThrowIfNull ( queryOptions ) ;
165172
@@ -170,7 +177,7 @@ public async Task<ISet<string>> GetServiceIdsAsync(QueryOptions queryOptions, Ca
170177 return new HashSet < string > ( ) ;
171178 }
172179
173- QueryResult < Dictionary < string , string [ ] > > result = await _client . Catalog . Services ( queryOptions , cancellationToken ) ;
180+ QueryResult < Dictionary < string , string [ ] > > result = await _client . Catalog . Services ( dataCenter , filter , queryOptions , cancellationToken ) ;
174181 return result . Response . Keys . ToHashSet ( ) ;
175182 }
176183
0 commit comments