internal static async Task <BulkEnrollmentOperationResult> BulkOperationAsync(
            IContractApiHttp contractApiHttp,
            BulkOperationMode bulkOperationMode,
            IEnumerable <IndividualEnrollment> individualEnrollments,
            CancellationToken cancellationToken)
        {
            if (individualEnrollments == null)
            {
                throw new ArgumentNullException(nameof(individualEnrollments));
            }

            if (!individualEnrollments.Any())
            {
                throw new ArgumentException($"{nameof(individualEnrollments)} cannot be empty.");
            }

            ContractApiResponse contractApiResponse = await contractApiHttp
                                                      .RequestAsync(
                HttpMethod.Post,
                GetEnrollmentUri(),
                null,
                BulkEnrollmentOperation.ToJson(bulkOperationMode, individualEnrollments),
                null,
                cancellationToken)
                                                      .ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            return(JsonConvert.DeserializeObject <BulkEnrollmentOperationResult>(contractApiResponse.Body));
        }
Example #2
0
        internal static async Task <DeviceRegistrationState> GetAsync(
            IContractApiHttp contractApiHttp,
            string id,
            CancellationToken cancellationToken)
        {
            /* SRS_REGISTRATION_STATUS_MANAGER_28_001: [The GetAsync shall throw ArgumentException if the provided ID is null or empty.] */
            ParserUtils.EnsureRegistrationId(id);

            /* SRS_REGISTRATION_STATUS_MANAGER_28_002: [The GetAsync shall sent the Get HTTP request to get the deviceRegistrationState information.] */
            ContractApiResponse contractApiResponse = await contractApiHttp.RequestAsync(
                HttpMethod.Get,
                GetDeviceRegistrationStatusUri(id),
                null,
                null,
                null,
                cancellationToken).ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            /* SRS_REGISTRATION_STATUS_MANAGER_28_003: [The GetAsync shall return a DeviceRegistrationState object created from the body of the HTTP response.] */
            return(JsonConvert.DeserializeObject <DeviceRegistrationState>(contractApiResponse.Body));
        }
        internal static async Task <IndividualEnrollment> CreateOrUpdateAsync(
            IContractApiHttp contractApiHttp,
            IndividualEnrollment individualEnrollment,
            CancellationToken cancellationToken)
        {
            if (individualEnrollment == null)
            {
                throw new ArgumentNullException(nameof(individualEnrollment));
            }

            ContractApiResponse contractApiResponse = await contractApiHttp
                                                      .RequestAsync(
                HttpMethod.Put,
                GetEnrollmentUri(individualEnrollment.RegistrationId),
                null,
                JsonConvert.SerializeObject(individualEnrollment),
                individualEnrollment.ETag,
                cancellationToken)
                                                      .ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            return(JsonConvert.DeserializeObject <IndividualEnrollment>(contractApiResponse.Body));
        }
Example #4
0
        internal static async Task <IndividualEnrollment> GetAsync(
            IContractApiHttp contractApiHttp,
            string registrationId,
            CancellationToken cancellationToken)
        {
            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_007: [The GetAsync shall throw ArgumentException if the provided registrationId is null or empty.] */
            ParserUtils.EnsureRegistrationId(registrationId);

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_008: [The GetAsync shall sent the Get HTTP request to get the individualEnrollment information.] */
            ContractApiResponse contractApiResponse = await contractApiHttp.RequestAsync(
                HttpMethod.Get,
                GetEnrollmentUri(registrationId),
                null,
                null,
                null,
                cancellationToken).ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_009: [The GetAsync shall return an IndividualEnrollment object created from the body of the HTTP response.] */
            return(JsonConvert.DeserializeObject <IndividualEnrollment>(contractApiResponse.Body));
        }
Example #5
0
        internal static async Task <IndividualEnrollment> CreateOrUpdateAsync(
            IContractApiHttp contractApiHttp,
            IndividualEnrollment individualEnrollment,
            CancellationToken cancellationToken)
        {
            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_001: [The CreateOrUpdateAsync shall throw ArgumentException if the provided individualEnrollment is null.] */
            if (individualEnrollment == null)
            {
                throw new ArgumentNullException(nameof(individualEnrollment));
            }

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_002: [The CreateOrUpdateAsync shall sent the Put HTTP request to create or update the individualEnrollment.] */
            ContractApiResponse contractApiResponse = await contractApiHttp.RequestAsync(
                HttpMethod.Put,
                GetEnrollmentUri(individualEnrollment.RegistrationId),
                null,
                JsonConvert.SerializeObject(individualEnrollment),
                individualEnrollment.ETag,
                cancellationToken).ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_003: [The CreateOrUpdateAsync shall return an IndividualEnrollment object created from the body of the HTTP response.] */
            return(JsonConvert.DeserializeObject <IndividualEnrollment>(contractApiResponse.Body));
        }
Example #6
0
        internal static async Task <EnrollmentGroup> CreateOrUpdateAsync(
            IContractApiHttp contractApiHttp,
            EnrollmentGroup enrollmentGroup,
            CancellationToken cancellationToken)
        {
            if (enrollmentGroup == null)
            {
                throw new ArgumentNullException(nameof(enrollmentGroup));
            }

            ContractApiResponse contractApiResponse = await contractApiHttp
                                                      .RequestAsync(
                HttpMethod.Put,
                GetEnrollmentUri(enrollmentGroup.EnrollmentGroupId),
                null,
                JsonConvert.SerializeObject(enrollmentGroup),
                enrollmentGroup.ETag,
                cancellationToken)
                                                      .ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            return(JsonConvert.DeserializeObject <EnrollmentGroup>(contractApiResponse.Body));
        }
        internal static async Task <EnrollmentGroup> CreateOrUpdateAsync(
            IContractApiHttp contractApiHttp,
            EnrollmentGroup enrollmentGroup,
            CancellationToken cancellationToken)
        {
            /* SRS_ENROLLMENT_GROUP_MANAGER_28_001: [The CreateOrUpdateAsync shall throw ArgumentNullException if the provided enrollmentGroup is null.] */
            if (enrollmentGroup == null)
            {
                throw new ArgumentNullException(nameof(enrollmentGroup));
            }

            /* SRS_ENROLLMENT_GROUP_MANAGER_28_002: [The CreateOrUpdateAsync shall sent the Put HTTP request to create or update the enrollmentGroup.] */
            ContractApiResponse contractApiResponse = await contractApiHttp.RequestAsync(
                HttpMethod.Put,
                GetEnrollmentUri(enrollmentGroup.EnrollmentGroupId),
                null,
                JsonConvert.SerializeObject(enrollmentGroup),
                enrollmentGroup.ETag,
                cancellationToken).ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            /* SRS_ENROLLMENT_GROUP_MANAGER_28_003: [The CreateOrUpdateAsync shall return an enrollmentGroup object created from the body of the HTTP response.] */
            return(JsonConvert.DeserializeObject <EnrollmentGroup>(contractApiResponse.Body));
        }
Example #8
0
        internal static async Task <BulkEnrollmentOperationResult> BulkOperationAsync(
            IContractApiHttp contractApiHttp,
            BulkOperationMode bulkOperationMode,
            IEnumerable <IndividualEnrollment> individualEnrollments,
            CancellationToken cancellationToken)
        {
            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_004: [The BulkOperationAsync shall throw ArgumentException if the provided
             *                                      individualEnrollments is null or empty.] */
            if (!(individualEnrollments ?? throw new ArgumentNullException(nameof(individualEnrollments))).Any())
            {
                throw new ArgumentException($"{nameof(individualEnrollments)} cannot be empty");
            }

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_005: [The BulkOperationAsync shall sent the Put HTTP request to run the bulk operation to the collection of the individualEnrollment.] */
            ContractApiResponse contractApiResponse = await contractApiHttp.RequestAsync(
                HttpMethod.Post,
                GetEnrollmentUri(),
                null,
                BulkEnrollmentOperation.ToJson(bulkOperationMode, individualEnrollments),
                null,
                cancellationToken).ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_006: [The BulkOperationAsync shall return an BulkEnrollmentOperationResult object created from the body of the HTTP response.] */
            return(JsonConvert.DeserializeObject <BulkEnrollmentOperationResult>(contractApiResponse.Body));
        }
 internal static async Task DeleteAsync(
     IContractApiHttp contractApiHttp,
     string id,
     CancellationToken cancellationToken,
     string eTag = null)
 {
     /* SRS_REGISTRATION_STATUS_MANAGER_28_007: [The DeleteAsync shall sent the Delete HTTP request to remove the deviceRegistrationState.] */
     await contractApiHttp.RequestAsync(
         HttpMethod.Delete,
         GetDeviceRegistrationStatusUri(id),
         null,
         null,
         eTag,
         cancellationToken).ConfigureAwait(false);
 }
 internal static async Task DeleteAsync(
     IContractApiHttp contractApiHttp,
     string enrollmentGroupId,
     CancellationToken cancellationToken,
     string eTag = null)
 {
     /* SRS_ENROLLMENT_GROUP_MANAGER_28_013: [The DeleteAsync shall sent the Delete HTTP request to remove the EnrollmentGroup.] */
     await contractApiHttp.RequestAsync(
         HttpMethod.Delete,
         GetEnrollmentUri(enrollmentGroupId),
         null,
         null,
         eTag,
         cancellationToken).ConfigureAwait(false);
 }
Example #11
0
 internal static async Task DeleteAsync(
     IContractApiHttp contractApiHttp,
     string registrationId,
     CancellationToken cancellationToken,
     string eTag = null)
 {
     /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_013: [The DeleteAsync shall sent the Delete HTTP request to remove the individualEnrollment.] */
     await contractApiHttp.RequestAsync(
         HttpMethod.Delete,
         GetEnrollmentUri(registrationId),
         null,
         null,
         eTag,
         cancellationToken).ConfigureAwait(false);
 }
 internal static async Task DeleteAsync(
     IContractApiHttp contractApiHttp,
     string id,
     CancellationToken cancellationToken,
     string eTag = null)
 {
     await contractApiHttp
     .RequestAsync(
         HttpMethod.Delete,
         GetDeviceRegistrationStatusUri(id),
         null,
         null,
         eTag,
         cancellationToken)
     .ConfigureAwait(false);
 }
 internal static async Task DeleteAsync(
     IContractApiHttp contractApiHttp,
     string registrationId,
     CancellationToken cancellationToken,
     string eTag = null)
 {
     await contractApiHttp
     .RequestAsync(
         HttpMethod.Delete,
         GetEnrollmentUri(registrationId),
         null,
         null,
         eTag,
         cancellationToken)
     .ConfigureAwait(false);
 }
Example #14
0
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            string id,
            CancellationToken cancellationToken,
            string eTag = null)
        {
            /* SRS_REGISTRATION_STATUS_MANAGER_28_006: [The DeleteAsync shall throw ArgumentException if the provided id is null or empty.] */
            ParserUtils.EnsureRegistrationId(id);

            /* SRS_REGISTRATION_STATUS_MANAGER_28_007: [The DeleteAsync shall sent the Delete HTTP request to remove the deviceRegistrationState.] */
            await contractApiHttp.RequestAsync(
                HttpMethod.Delete,
                GetDeviceRegistrationStatusUri(id),
                null,
                null,
                eTag,
                cancellationToken).ConfigureAwait(false);
        }
Example #15
0
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            string enrollmentGroupId,
            CancellationToken cancellationToken,
            string eTag = null)
        {
            /* SRS_ENROLLMENT_GROUP_MANAGER_28_012: [The DeleteAsync shall throw ArgumentException if the provided enrollmentGroupId is null or empty.] */
            ParserUtils.EnsureValidId(enrollmentGroupId);

            /* SRS_ENROLLMENT_GROUP_MANAGER_28_013: [The DeleteAsync shall sent the Delete HTTP request to remove the EnrollmentGroup.] */
            await contractApiHttp.RequestAsync(
                HttpMethod.Delete,
                GetEnrollmentUri(enrollmentGroupId),
                null,
                null,
                eTag,
                cancellationToken).ConfigureAwait(false);
        }
Example #16
0
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            string registrationId,
            CancellationToken cancellationToken,
            string eTag = null)
        {
            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_012: [The DeleteAsync shall throw ArgumentException if the provided registrationId is null or empty.] */
            ParserUtils.EnsureRegistrationId(registrationId);

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_013: [The DeleteAsync shall sent the Delete HTTP request to remove the individualEnrollment.] */
            await contractApiHttp.RequestAsync(
                HttpMethod.Delete,
                GetEnrollmentUri(registrationId),
                null,
                null,
                eTag,
                cancellationToken).ConfigureAwait(false);
        }
Example #17
0
        /// <summary>
        /// Return the next page of result for the query.
        /// </summary>
        /// <returns>The <see cref="QueryResult"/> with the next page of items for the query.</returns>
        /// <exception cref="IndexOutOfRangeException">if the query does no have more pages to return.</exception>
        public async Task <QueryResult> NextAsync()
        {
            /* SRS_QUERY_21_014: [The next shall throw IndexOutOfRangeException if the hasNext is false.] */
            if (!_hasNext)
            {
                throw new IndexOutOfRangeException("There are no more pending elements");
            }

            /* SRS_QUERY_21_015: [If the pageSize is not 0, the next shall send the HTTP request with `x-ms-max-item-count=[pageSize]` in the header.] */
            IDictionary <string, string> headerParameters = new Dictionary <string, string>();

            if (PageSize != 0)
            {
                headerParameters.Add(PageSizeHeaderKey, PageSize.ToString(CultureInfo.InvariantCulture));
            }
            /* SRS_QUERY_21_016: [If the continuationToken is not null or empty, the next shall send the HTTP request with `x-ms-continuation=[continuationToken]` in the header.] */
            if (!string.IsNullOrWhiteSpace(ContinuationToken))
            {
                headerParameters.Add(ContinuationTokenHeaderKey, ContinuationToken);
            }

            /* SRS_QUERY_21_017: [The next shall send a HTTP request with a HTTP verb `POST`.] */
            ContractApiResponse httpResponse = await _contractApiHttp.RequestAsync(
                HttpMethod.Post,
                _queryPath,
                headerParameters,
                _querySpecificationJson,
                null,
                _cancellationToken).ConfigureAwait(false);

            /* SRS_QUERY_21_018: [The next shall create and return a new instance of the QueryResult using the `x-ms-item-type` as type, `x-ms-continuation` as the next continuationToken, and the message body.] */
            httpResponse.Fields.TryGetValue(ItemTypeHeaderKey, out string type);
            httpResponse.Fields.TryGetValue(ContinuationTokenHeaderKey, out string continuationToken);
            ContinuationToken = continuationToken;

            /* SRS_QUERY_21_017: [The next shall set hasNext as true if the continuationToken is not null, or false if it is null.] */
            _hasNext = (ContinuationToken != null);

            QueryResult result = new QueryResult(type, httpResponse.Body, ContinuationToken);

            return(result);
        }
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            DeviceRegistrationState deviceRegistrationState,
            CancellationToken cancellationToken)
        {
            if (deviceRegistrationState == null)
            {
                throw new ArgumentNullException(nameof(deviceRegistrationState));
            }

            await contractApiHttp
            .RequestAsync(
                HttpMethod.Delete,
                GetDeviceRegistrationStatusUri(deviceRegistrationState.RegistrationId),
                null,
                null,
                deviceRegistrationState.ETag,
                cancellationToken)
            .ConfigureAwait(false);
        }
Example #19
0
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            IndividualEnrollment individualEnrollment,
            CancellationToken cancellationToken)
        {
            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_010: [The DeleteAsync shall throw ArgumentException if the provided individualEnrollment is null.] */
            if (individualEnrollment == null)
            {
                throw new ArgumentNullException(nameof(individualEnrollment));
            }

            /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_011: [The DeleteAsync shall sent the Delete HTTP request to remove the individualEnrollment.] */
            await contractApiHttp.RequestAsync(
                HttpMethod.Delete,
                GetEnrollmentUri(individualEnrollment.RegistrationId),
                null,
                null,
                individualEnrollment.ETag,
                cancellationToken).ConfigureAwait(false);
        }
Example #20
0
        internal static async Task <AttestationMechanism> GetEnrollmentAttestationAsync(
            IContractApiHttp contractApiHttp,
            string registrationId,
            CancellationToken cancellationToken)
        {
            ContractApiResponse contractApiResponse = await contractApiHttp.RequestAsync(
                HttpMethod.Post,
                GetEnrollmentAttestationUri(registrationId),
                null,
                null,
                null,
                cancellationToken).ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            return(JsonConvert.DeserializeObject <AttestationMechanism>(contractApiResponse.Body));
        }
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            EnrollmentGroup enrollmentGroup,
            CancellationToken cancellationToken)
        {
            /* SRS_ENROLLMENT_GROUP_MANAGER_28_010: [The DeleteAsync shall throw ArgumentNullException if the provided enrollmentGroup is null.] */
            if (enrollmentGroup == null)
            {
                throw new ArgumentNullException(nameof(enrollmentGroup));
            }

            /* SRS_ENROLLMENT_GROUP_MANAGER_28_011: [The DeleteAsync shall sent the Delete HTTP request to remove the enrollmentGroup.] */
            await contractApiHttp.RequestAsync(
                HttpMethod.Delete,
                GetEnrollmentUri(enrollmentGroup.EnrollmentGroupId),
                null,
                null,
                enrollmentGroup.ETag,
                cancellationToken).ConfigureAwait(false);
        }
Example #22
0
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            DeviceRegistrationState deviceRegistrationState,
            CancellationToken cancellationToken)
        {
            /* SRS_REGISTRATION_STATUS_MANAGER_28_004: [The DeleteAsync shall throw ArgumentException if the provided deviceRegistrationState is null.] */
            if (deviceRegistrationState == null)
            {
                throw new ArgumentNullException(nameof(deviceRegistrationState));
            }

            /* SRS_REGISTRATION_STATUS_MANAGER_28_005: [The DeleteAsync shall sent the Delete HTTP request to remove the deviceRegistrationState.] */
            await contractApiHttp.RequestAsync(
                HttpMethod.Delete,
                GetDeviceRegistrationStatusUri(deviceRegistrationState.RegistrationId),
                null,
                null,
                deviceRegistrationState.ETag,
                cancellationToken).ConfigureAwait(false);
        }
Example #23
0
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            EnrollmentGroup enrollmentGroup,
            CancellationToken cancellationToken)
        {
            if (enrollmentGroup == null)
            {
                throw new ArgumentNullException(nameof(enrollmentGroup));
            }

            await contractApiHttp
            .RequestAsync(
                HttpMethod.Delete,
                GetEnrollmentUri(enrollmentGroup.EnrollmentGroupId),
                null,
                null,
                enrollmentGroup.ETag,
                cancellationToken)
            .ConfigureAwait(false);
        }
        internal static async Task DeleteAsync(
            IContractApiHttp contractApiHttp,
            IndividualEnrollment individualEnrollment,
            CancellationToken cancellationToken)
        {
            if (individualEnrollment == null)
            {
                throw new ArgumentNullException(nameof(individualEnrollment));
            }

            await contractApiHttp
            .RequestAsync(
                HttpMethod.Delete,
                GetEnrollmentUri(individualEnrollment.RegistrationId),
                null,
                null,
                individualEnrollment.ETag,
                cancellationToken)
            .ConfigureAwait(false);
        }
Example #25
0
        /// <summary>
        /// Return the next page of result for the query.
        /// </summary>
        /// <returns>The <see cref="QueryResult"/> with the next page of items for the query.</returns>
        /// <exception cref="IndexOutOfRangeException">if the query does no have more pages to return.</exception>
        public async Task <QueryResult> NextAsync()
        {
            if (!_hasNext)
            {
                throw new IndexOutOfRangeException("There are no more pending elements");
            }

            IDictionary <string, string> headerParameters = new Dictionary <string, string>();

            if (PageSize != 0)
            {
                headerParameters.Add(PageSizeHeaderKey, PageSize.ToString(CultureInfo.InvariantCulture));
            }

            if (!string.IsNullOrWhiteSpace(ContinuationToken))
            {
                headerParameters.Add(ContinuationTokenHeaderKey, ContinuationToken);
            }

            ContractApiResponse httpResponse = await _contractApiHttp
                                               .RequestAsync(
                HttpMethod.Post,
                _queryPath,
                headerParameters,
                _querySpecificationJson,
                null,
                _cancellationToken)
                                               .ConfigureAwait(false);

            httpResponse.Fields.TryGetValue(ItemTypeHeaderKey, out string type);
            httpResponse.Fields.TryGetValue(ContinuationTokenHeaderKey, out string continuationToken);
            ContinuationToken = continuationToken;

            _hasNext = ContinuationToken != null;

            var result = new QueryResult(type, httpResponse.Body, ContinuationToken);

            return(result);
        }
        internal static async Task <DeviceRegistrationState> GetAsync(
            IContractApiHttp contractApiHttp,
            string id,
            CancellationToken cancellationToken)
        {
            ContractApiResponse contractApiResponse = await contractApiHttp
                                                      .RequestAsync(
                HttpMethod.Get,
                GetDeviceRegistrationStatusUri(id),
                null,
                null,
                null,
                cancellationToken)
                                                      .ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            return(JsonConvert.DeserializeObject <DeviceRegistrationState>(contractApiResponse.Body));
        }
        internal static async Task <EnrollmentGroup> GetAsync(
            IContractApiHttp contractApiHttp,
            string enrollmentGroupId,
            CancellationToken cancellationToken)
        {
            /* SRS_ENROLLMENT_GROUP_MANAGER_28_008: [The GetAsync shall sent the Get HTTP request to get the enrollmentGroup information.] */
            ContractApiResponse contractApiResponse = await contractApiHttp.RequestAsync(
                HttpMethod.Get,
                GetEnrollmentUri(enrollmentGroupId),
                null,
                null,
                null,
                cancellationToken).ConfigureAwait(false);

            if (contractApiResponse.Body == null)
            {
                throw new ProvisioningServiceClientHttpException(contractApiResponse, true);
            }

            /* SRS_ENROLLMENT_GROUP_MANAGER_28_009: [The GetAsync shall return an EnrollmentGroup object created from the body of the HTTP response.] */
            return(JsonConvert.DeserializeObject <EnrollmentGroup>(contractApiResponse.Body));
        }