示例#1
0
        public async Task DeleteEventHubAsync(EventHubModel eventHub)
        {
            await EnsureAuthenticatedAsync();

            Trace.WriteLine($"Deletes event hub: {eventHub.CreatedName}");

            await _client.EventHubs.DeleteAsync(_azureResourceIdentifier.ResourceGroupName,
                                                _azureResourceIdentifier.Name, eventHub.CreatedName);
        }
示例#2
0
        public async Task CreateEventHubAsync(EventHubModel eventHub)
        {
            await EnsureAuthenticatedAsync();

            Trace.WriteLine($"Create event hub: {eventHub.CreatedName}");

            var newEventHub = new Eventhub {
                MessageRetentionInDays = 1, PartitionCount = 1
            };
            await _client.EventHubs.CreateOrUpdateAsync(_azureResourceIdentifier.ResourceGroupName,
                                                        _azureResourceIdentifier.Name, eventHub.CreatedName, newEventHub);

            var autRuleParams = new AuthorizationRule {
                Rights = new List <string> {
                    "send", "listen"
                }
            };
            await _client.EventHubs.CreateOrUpdateAuthorizationRuleAsync(_azureResourceIdentifier.ResourceGroupName,
                                                                         _azureResourceIdentifier.Name, eventHub.CreatedName, "sender", autRuleParams);
        }
示例#3
0
 private async Task CreateEventHubAsync(EventHubModel eventHub)
 {
     eventHub.CreatedName = eventHub.Name;
     await _eventHubManager.CreateEventHubAsync(eventHub);
 }