Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use paging when getting service identities from ACS

Background I require a list of all the service identity names I have registered in the Azure ACS. I have an Azure Management Service reference I got from https://myaccesscontrol.accesscontrol.windows.net/v2/mgmt/service. The “myaccesscontrol” prefix is arbitrary, for this discussion. You could use a different subscription namespace prefix and get the same results, if I understand correctly. This is the service endpoint that Azure gives me when I subscribe. It exposes a ManagementService interface. When I get a list of service identities

  DataServiceQuery<ServiceIdentity> identities = managementService.ServiceIdentities;

I get back an object that has a count of all the identities I expect. When I expand the list I get the first 50. This is typical of a paged response, and I expect that there is a continuation token that will allow me to get the next “page”.

Problem I can’t see how the ManagementServiceReference.ManagementService interface can be used to obtain a continuation token.

Discussion How to: Load Paged Results (WCF Data Services) at http://msdn.microsoft.com/en-us/library/ee358711.aspx provides an example where a QueryOperationResponse response from LINQ context can be queried for continuation with token = response.GetContinuation() The QueryOperationResponse is retrieved from a LINQ context Execute().

In some Azure sample code I have, there are examples of paging for blobs, tables, and queues, where data is collected in a ResultSegment. A ResultSegment has a Boolean HasMoreResults member, a ResultContinuationToken ContinuationToken member, and methods that accept and maintain these to support paging operations.

I don’t see how to obtain a Continuation from a DataServiceQuery. I don’t see that the ManagementServiceReference.ManagementService exposed by Azure supports a paged list of service identities, even though the service is, apparently, paging the results it sends me. Can you point me to the right article that will show me how the DataServiceQuery can be treated in a way that I get a Continuation back?

like image 306
SkipSailors Avatar asked Nov 21 '25 18:11

SkipSailors


1 Answers

Using the management service sample project that's available here, what you want would look something like this:

ManagementService mgmtSvc = ManagementServiceHelper.CreateManagementServiceClient();
List<ServiceIdentity> serviceIdentities = new List<ServiceIdentity>();

// Get the first page
var queryResponse = mgmtSvc.ServiceIdentities.Execute();
serviceIdentities.AddRange( queryResponse.ToList() );

// Get the rest
while ( null != ( (QueryOperationResponse)queryResponse ).GetContinuation() )
{
    DataServiceQueryContinuation<ServiceIdentity> continuation =
        ( (QueryOperationResponse<ServiceIdentity>)queryResponse ).GetContinuation();
    queryResponse = mgmtSvc.Execute( continuation );
    serviceIdentities.AddRange( queryResponse.ToList() );
}
like image 86
Andrew Lavers Avatar answered Nov 23 '25 09:11

Andrew Lavers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!