Exemplo n.º 1
0
        public async Task RegisterThing(string thingName, string thingType)
        {
            var createThingGroupRequest = new CreateThingRequest()
            {
                ThingName     = thingName,
                ThingTypeName = thingType
            };

            var createThingResponse = await _client.CreateThingAsync(createThingGroupRequest);

            var certificate = await CreateCertificate();

            await _certificateStore.StoreCertificate(certificate.CertificateId, certificate.CertificatePem);

            await AttachThingToCertificate(createThingResponse.ThingName, certificate.CertificateArn);
            await CreatePolicy(thingType);
            await AttachPolicyToCertificate(thingType, certificate.CertificateArn);
        }