public IoTHubResource(IAzureRMSubscription subscription, IoTHub iotHubAccount) { _subscription = Arguments.ValidateNotNull(subscription, nameof(subscription)); _iotHub = Arguments.ValidateNotNull(iotHubAccount, nameof(iotHubAccount)); _properties = new Dictionary<string, string>() { { "IoTHubName", iotHubAccount.Name }, { "Region", iotHubAccount.Location }, { "SubscriptionName", subscription.SubscriptionName }, { "ResourceGroup", iotHubAccount.ResourceGroup }, { "Tier", iotHubAccount.Tier() }, { "iotHubUri", iotHubAccount.Properties.HostName }, }; }
public IoTHubResource(IAzureRMSubscription subscription, IoTHub iotHubAccount) { _subscription = Arguments.ValidateNotNull(subscription, nameof(subscription)); _iotHub = Arguments.ValidateNotNull(iotHubAccount, nameof(iotHubAccount)); _properties = new Dictionary <string, string>() { { "IoTHubName", iotHubAccount.Name }, { "Region", iotHubAccount.Location }, { "SubscriptionName", subscription.SubscriptionName }, { "ResourceGroup", iotHubAccount.ResourceGroup }, { "Tier", iotHubAccount.Tier() }, { "iotHubUri", iotHubAccount.Properties.HostName }, }; }
public static async Task <IoTHub> GetIoTHubDetailsAsync(this ServiceManagementHttpClient client, IoTHub iotHubAccount, CancellationToken cancellationToken) { /// POST: /// subscriptions/{subscriptionId}/resourceGroups/ /// {resourceGroupName}/providers/Microsoft.Devices/IotHubs/ /// {IotHubName}/IoTHubKeys/listkeys?api-version={api-version} string relativeUrl = string.Format(CultureInfo.InvariantCulture, "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Devices/IotHubs/{2}/IoTHubKeys/listKeys?api-version={3}", client.SubscriptionId, Uri.EscapeDataString(iotHubAccount.ResourceGroup), Uri.EscapeDataString(iotHubAccount.Name), IoTHubPreviewApiVersion); AuthorizationPolicies authorizationPolicies = await client.PostEmptyBodyAsync <AuthorizationPolicies>(relativeUrl, cancellationToken).ConfigureAwait(false); iotHubAccount.AuthorizationPolicies = authorizationPolicies; return(iotHubAccount); }