From 7ea2df66c011916429a0f5147d3ea65b89210456 Mon Sep 17 00:00:00 2001 From: "David R. Williamson" Date: Wed, 22 Mar 2023 10:48:54 -0700 Subject: [PATCH] Formatting --- ...visioningServiceDeviceRegistrationTests.cs | 6 ++-- .../service/src/DeviceRegistrationsClient.cs | 22 +++++++++++---- .../service/src/EnrollmentGroupsClient.cs | 28 +++++++++++++++---- .../src/IndividualEnrollmentsClient.cs | 28 +++++++++++++++---- .../service/src/Utilities/QueryBuilder.cs | 9 +++++- 5 files changed, 73 insertions(+), 20 deletions(-) diff --git a/e2e/test/provisioning/ProvisioningServiceDeviceRegistrationTests.cs b/e2e/test/provisioning/ProvisioningServiceDeviceRegistrationTests.cs index b301181b9a..aaee7b0cf0 100644 --- a/e2e/test/provisioning/ProvisioningServiceDeviceRegistrationTests.cs +++ b/e2e/test/provisioning/ProvisioningServiceDeviceRegistrationTests.cs @@ -35,8 +35,7 @@ public async Task ProvisioningServiceClient_DeviceRegistrationState_Query_Ok() // Create an enrollment group so that the query is guaranteed to return at least one entry string enrollmentGroupId = Guid.NewGuid().ToString(); var enrollmentGroup = new EnrollmentGroup(enrollmentGroupId, new SymmetricKeyAttestation()); - await provisioningServiceClient.EnrollmentGroups - .CreateOrUpdateAsync(enrollmentGroup).ConfigureAwait(false); + await provisioningServiceClient.EnrollmentGroups.CreateOrUpdateAsync(enrollmentGroup).ConfigureAwait(false); try { @@ -51,8 +50,7 @@ await provisioningServiceClient.EnrollmentGroups { try { - await provisioningServiceClient.EnrollmentGroups - .DeleteAsync(enrollmentGroupId).ConfigureAwait(false); + await provisioningServiceClient.EnrollmentGroups.DeleteAsync(enrollmentGroupId).ConfigureAwait(false); } catch (Exception e) { diff --git a/provisioning/service/src/DeviceRegistrationsClient.cs b/provisioning/service/src/DeviceRegistrationsClient.cs index 52322eaf51..72636215a7 100644 --- a/provisioning/service/src/DeviceRegistrationsClient.cs +++ b/provisioning/service/src/DeviceRegistrationsClient.cs @@ -161,19 +161,31 @@ public AsyncPageable CreateEnrollmentGroupQuery(string try { - async Task> nextPageFunc(string continuationToken, int? pageSizeHint) + async Task> NextPageFunc(string continuationToken, int? pageSizeHint) { cancellationToken.ThrowIfCancellationRequested(); - return await QueryBuilder.BuildAndSendRequestAsync(_contractApiHttp, _internalRetryHandler, query, GetDeviceRegistrationQueryUri(enrollmentGroupId), continuationToken, pageSizeHint, cancellationToken).ConfigureAwait(false); + return await QueryBuilder + .BuildAndSendRequestAsync( + _contractApiHttp, + _internalRetryHandler, + query, + GetDeviceRegistrationQueryUri(enrollmentGroupId), continuationToken, pageSizeHint, cancellationToken) + .ConfigureAwait(false); } - async Task> firstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { cancellationToken.ThrowIfCancellationRequested(); - return await QueryBuilder.BuildAndSendRequestAsync(_contractApiHttp, _internalRetryHandler, query, GetDeviceRegistrationQueryUri(enrollmentGroupId), null, pageSizeHint, cancellationToken).ConfigureAwait(false); + return await QueryBuilder + .BuildAndSendRequestAsync( + _contractApiHttp, + _internalRetryHandler, + query, + GetDeviceRegistrationQueryUri(enrollmentGroupId), null, pageSizeHint, cancellationToken) + .ConfigureAwait(false); } - return PageableHelpers.CreateAsyncEnumerable(firstPageFunc, nextPageFunc, null); + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc, null); } catch (Exception ex) when (Logging.IsEnabled) { diff --git a/provisioning/service/src/EnrollmentGroupsClient.cs b/provisioning/service/src/EnrollmentGroupsClient.cs index 3597fa4ea7..91c3d1cf40 100644 --- a/provisioning/service/src/EnrollmentGroupsClient.cs +++ b/provisioning/service/src/EnrollmentGroupsClient.cs @@ -288,19 +288,37 @@ public AsyncPageable CreateQuery(string query, CancellationToke try { - async Task> nextPageFunc(string continuationToken, int? pageSizeHint) + async Task> NextPageFunc(string continuationToken, int? pageSizeHint) { cancellationToken.ThrowIfCancellationRequested(); - return await QueryBuilder.BuildAndSendRequestAsync(_contractApiHttp, _internalRetryHandler, query, GetEnrollmentGroupQueryUri(), continuationToken, pageSizeHint, cancellationToken).ConfigureAwait(false); + return await QueryBuilder + .BuildAndSendRequestAsync( + _contractApiHttp, + _internalRetryHandler, + query, + GetEnrollmentGroupQueryUri(), + continuationToken, + pageSizeHint, + cancellationToken) + .ConfigureAwait(false); } - async Task> firstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { cancellationToken.ThrowIfCancellationRequested(); - return await QueryBuilder.BuildAndSendRequestAsync(_contractApiHttp, _internalRetryHandler, query, GetEnrollmentGroupQueryUri(), null, pageSizeHint, cancellationToken).ConfigureAwait(false); + return await QueryBuilder + .BuildAndSendRequestAsync( + _contractApiHttp, + _internalRetryHandler, + query, + GetEnrollmentGroupQueryUri(), + null, + pageSizeHint, + cancellationToken) + .ConfigureAwait(false); } - return PageableHelpers.CreateAsyncEnumerable(firstPageFunc, nextPageFunc, null); + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc, null); } catch (Exception ex) when (Logging.IsEnabled) { diff --git a/provisioning/service/src/IndividualEnrollmentsClient.cs b/provisioning/service/src/IndividualEnrollmentsClient.cs index a1eeb52574..61814a2f41 100644 --- a/provisioning/service/src/IndividualEnrollmentsClient.cs +++ b/provisioning/service/src/IndividualEnrollmentsClient.cs @@ -278,19 +278,37 @@ public AsyncPageable CreateQuery(string query, Cancellatio try { - async Task> nextPageFunc(string continuationToken, int? pageSizeHint) + async Task> NextPageFunc(string continuationToken, int? pageSizeHint) { cancellationToken.ThrowIfCancellationRequested(); - return await QueryBuilder.BuildAndSendRequestAsync(_contractApiHttp, _internalRetryHandler, query, GetEnrollmentQueryUri(), continuationToken, pageSizeHint, cancellationToken).ConfigureAwait(false); + return await QueryBuilder + .BuildAndSendRequestAsync( + _contractApiHttp, + _internalRetryHandler, + query, + GetEnrollmentQueryUri(), + continuationToken, + pageSizeHint, + cancellationToken) + .ConfigureAwait(false); } - async Task> firstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { cancellationToken.ThrowIfCancellationRequested(); - return await QueryBuilder.BuildAndSendRequestAsync(_contractApiHttp, _internalRetryHandler, query, GetEnrollmentQueryUri(), null, pageSizeHint, cancellationToken).ConfigureAwait(false); + return await QueryBuilder + .BuildAndSendRequestAsync( + _contractApiHttp, + _internalRetryHandler, + query, + GetEnrollmentQueryUri(), + null, + pageSizeHint, + cancellationToken) + .ConfigureAwait(false); } - return PageableHelpers.CreateAsyncEnumerable(firstPageFunc, nextPageFunc, null); + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc, null); } catch (Exception ex) when (Logging.IsEnabled) { diff --git a/provisioning/service/src/Utilities/QueryBuilder.cs b/provisioning/service/src/Utilities/QueryBuilder.cs index b9ad9f8d94..6e54fa381d 100644 --- a/provisioning/service/src/Utilities/QueryBuilder.cs +++ b/provisioning/service/src/Utilities/QueryBuilder.cs @@ -19,7 +19,14 @@ internal class QueryBuilder private const string PageSizeHeaderKey = "x-ms-max-item-count"; private const string QueryUriFormat = "{0}/query"; - internal static async Task> BuildAndSendRequestAsync(ContractApiHttp contractApiHttp, RetryHandler retryHandler, string query, Uri path, string continuationToken, int? pageSizeHint, CancellationToken cancellationToken) + internal static async Task> BuildAndSendRequestAsync( + ContractApiHttp contractApiHttp, + RetryHandler retryHandler, + string query, + Uri path, + string continuationToken, + int? pageSizeHint, + CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested();