ProjectA
Bookmarks
Notes
Projects
Log in
Fetch of AWS IoT Core Thing Principals
Created 08/24/2026 12:18 · Last modified 08/25/2026 14:39
The Certificate/s attached to an IoT Core Thing exist as Principals recorded against the Thing. To be able to get all Principals that are associated with a Thing the following could be used ***Interface*** ``` public interface IIotClient { Task<List<string>> GetThingPrincipalsAsync(string thingName); } ``` ***Implementation*** ``` public class IoTClient : IIotClient { private readonly Amazon.IoT.AmazonIoTClient _awsIoTClient; public async Task<List<string>> GetThingPrincipalsAsync(string thingName) { var retVal = new List<string>(); try { var principalRequest = new Amazon.IoT.Model.ListThingPrincipalsRequest { ThingName = thingName }; var principalResponse = await _awsIoTClient.ListThingPrincipalsAsync(principalRequest); retVal.AddRange(principalResponse.Principals); } catch (Exception e) { _logger?.Error(e.ToString()); } return retVal; } } ```
Back to Notes