示例#1
0
        internal EnrollmentGroup(
            string enrollmentGroupId,
            AttestationMechanism attestation,
            string iotHubHostName,
            TwinState initialTwinState,
            ProvisioningStatus provisioningStatus,
            DateTime createdDateTimeUtc,
            DateTime lastUpdatedDateTimeUtc,
            string eTag)
        {
            /* SRS_ENROLLMENT_GROUP_21_003: [The constructor shall throws ProvisioningServiceClientException if one of the
             *                                      provided parameters in JSON is not valid.] */
            if (attestation == null)
            {
                throw new ProvisioningServiceClientException("Service respond an enrollmentGroup without attestation.");
            }

            try
            {
                /* SRS_ENROLLMENT_GROUP_21_004: [The constructor shall store all parameters in the JSON.] */
                EnrollmentGroupId      = enrollmentGroupId;
                Attestation            = attestation.GetAttestation();
                IotHubHostName         = iotHubHostName;
                InitialTwinState       = initialTwinState;
                ProvisioningStatus     = provisioningStatus;
                CreatedDateTimeUtc     = createdDateTimeUtc;
                LastUpdatedDateTimeUtc = lastUpdatedDateTimeUtc;
                ETag = eTag;
            }
            catch (ArgumentException e)
            {
                throw new ProvisioningServiceClientException(e);
            }
        }
        internal IndividualEnrollment(
            string registrationId,
            AttestationMechanism attestation,
            string deviceId,
            string iotHubHostName,
            TwinState initialTwinState,
            ProvisioningStatus?provisioningStatus,
            DateTime createdDateTimeUtc,
            DateTime lastUpdatedDateTimeUtc,
            string eTag,
            DeviceCapabilities capabilities)
        {
            if (attestation == null)
            {
                throw new ProvisioningServiceClientException("Service respond an individualEnrollment without attestation.");
            }

            try
            {
                RegistrationId         = registrationId;
                DeviceId               = deviceId;
                Attestation            = attestation.GetAttestation();
                IotHubHostName         = iotHubHostName;
                InitialTwinState       = initialTwinState;
                ProvisioningStatus     = provisioningStatus;
                CreatedDateTimeUtc     = createdDateTimeUtc;
                LastUpdatedDateTimeUtc = lastUpdatedDateTimeUtc;
                ETag         = eTag;
                Capabilities = capabilities;
            }
            catch (ArgumentException e)
            {
                throw new ProvisioningServiceClientException(e);
            }
        }
        internal IndividualEnrollment(
            string registrationId,
            AttestationMechanism attestation,
            string deviceId,
            string iotHubHostName,
            TwinState initialTwinState,
            ProvisioningStatus?provisioningStatus,
            DateTime createdDateTimeUtc,
            DateTime lastUpdatedDateTimeUtc,
            string eTag,
            DeviceCapabilities capabilities)
        {
            /* SRS_INDIVIDUAL_ENROLLMENT_21_003: [The constructor shall throws ProvisioningServiceClientException if one of the
             *                                      provided parameters in JSON is not valid.] */
            if (attestation == null)
            {
                throw new ProvisioningServiceClientException("Service respond an individualEnrollment without attestation.");
            }

            try
            {
                /* SRS_INDIVIDUAL_ENROLLMENT_21_004: [The constructor shall store all parameters in the JSON.] */
                RegistrationId         = registrationId;
                DeviceId               = deviceId;
                Attestation            = attestation.GetAttestation();
                IotHubHostName         = iotHubHostName;
                InitialTwinState       = initialTwinState;
                ProvisioningStatus     = provisioningStatus;
                CreatedDateTimeUtc     = createdDateTimeUtc;
                LastUpdatedDateTimeUtc = lastUpdatedDateTimeUtc;
                ETag         = eTag;
                Capabilities = capabilities;
            }
            catch (ArgumentException e)
            {
                throw new ProvisioningServiceClientException(e);
            }
        }