コード例 #1
0
        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());
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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;
        }