public async Task <IEnumerable <IAzureIoTHub> > EnumerateIoTHubAccountsAsync(IAzureRMSubscription subscription, CancellationToken cancellationToken) { var builder = new ServiceManagementHttpClientBuilder(subscription); var client = await builder.CreateAsync().ConfigureAwait(false); IoTHubListResponse response = await ServiceManagementHttpClientExtensions.GetIoTHubsAsync(client, cancellationToken).ConfigureAwait(false); return(response.Accounts.Select(p => new IoTHubResource(subscription, p)).ToList()); }
public async Task<IEnumerable<IAzureIoTHub>> EnumerateIoTHubAccountsAsync(IAzureRMSubscription subscription, CancellationToken cancellationToken) { var builder = new ServiceManagementHttpClientBuilder(subscription); var client = await builder.CreateAsync().ConfigureAwait(false); IoTHubListResponse response = await ServiceManagementHttpClientExtensions.GetIoTHubsAsync(client, cancellationToken).ConfigureAwait(false); return response.Accounts.Select(p => new IoTHubResource(subscription, p)).ToList(); }
public async Task <PrimaryKeys> GetPrimaryKeysAsync(CancellationToken cancellationToken) { var builder = new ServiceManagementHttpClientBuilder(_subscription); var client = await builder.CreateAsync().ConfigureAwait(false); var detailedAccount = await client.GetIoTHubDetailsAsync(_iotHub, cancellationToken); var keys = new PrimaryKeys { IoTHubOwner = detailedAccount.GetIoTHubOwnerPrimaryKey(), Service = detailedAccount.GetServicePrimaryKey() }; return(keys); }
public async Task<PrimaryKeys> GetPrimaryKeysAsync(CancellationToken cancellationToken) { var builder = new ServiceManagementHttpClientBuilder(_subscription); var client = await builder.CreateAsync().ConfigureAwait(false); var detailedAccount = await client.GetIoTHubDetailsAsync(_iotHub, cancellationToken); var keys = new PrimaryKeys { IoTHubOwner = detailedAccount.GetIoTHubOwnerPrimaryKey(), Service = detailedAccount.GetServicePrimaryKey() }; return keys; }