Skip to content

Commit 2a1c5ce

Browse files
author
maddieclayton
authored
Merge pull request #5347 from v-Ajnava/EHGeoDR_2017
Event Hubs: GeoDR cmdlets
2 parents c47b208 + 0d952c1 commit 2a1c5ce

File tree

87 files changed

+13201
-123506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+13201
-123506
lines changed

src/ResourceManager/EventHub/AzureRM.EventHub.psd1

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,22 @@ NestedModules = @('.\Microsoft.Azure.Commands.EventHub.dll')
7272
FunctionsToExport = @()
7373

7474
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75-
CmdletsToExport = 'New-AzureRmEventHubNamespace', 'Get-AzureRmEventHubNamespace',
76-
'Set-AzureRmEventHubNamespace', 'Remove-AzureRmEventHubNamespace',
77-
'New-AzureRmEventHubAuthorizationRule',
78-
'Get-AzureRmEventHubAuthorizationRule',
79-
'Set-AzureRmEventHubAuthorizationRule',
80-
'Remove-AzureRmEventHubAuthorizationRule', 'Get-AzureRmEventHubKey',
81-
'New-AzureRmEventHubKey', 'New-AzureRmEventHub',
82-
'Get-AzureRmEventHub', 'Set-AzureRmEventHub',
83-
'Remove-AzureRmEventHub', 'New-AzureRmEventHubConsumerGroup',
84-
'Get-AzureRmEventHubConsumerGroup',
85-
'Set-AzureRmEventHubConsumerGroup',
86-
'Remove-AzureRmEventHubConsumerGroup'
8775

76+
CmdletsToExport = 'New-AzureRmEventHubNamespace', 'Get-AzureRmEventHubNamespace',
77+
'Set-AzureRmEventHubNamespace', 'Remove-AzureRmEventHubNamespace',
78+
'New-AzureRmEventHubAuthorizationRule',
79+
'Get-AzureRmEventHubAuthorizationRule',
80+
'Set-AzureRmEventHubAuthorizationRule',
81+
'Remove-AzureRmEventHubAuthorizationRule', 'Get-AzureRmEventHubKey',
82+
'New-AzureRmEventHubKey', 'New-AzureRmEventHub',
83+
'Get-AzureRmEventHub', 'Set-AzureRmEventHub',
84+
'Remove-AzureRmEventHub', 'New-AzureRmEventHubConsumerGroup',
85+
'Get-AzureRmEventHubConsumerGroup',
86+
'Set-AzureRmEventHubConsumerGroup',
87+
'Remove-AzureRmEventHubConsumerGroup', 'New-AzureRmEventHubGeoDRConfiguration', 'Get-AzureRmEventHubGeoDRConfiguration', 'Remove-AzureRmEventHubGeoDRConfiguration',
88+
'Set-AzureRmEventHubGeoDRConfigurationBreakPair', 'Set-AzureRmEventHubGeoDRConfigurationFailOver',
89+
'Test-AzureRmEventHubName'
90+
8891
# Variables to export from this module
8992
# VariablesToExport = @()
9093

@@ -140,5 +143,4 @@ PrivateData = @{
140143
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
141144
# DefaultCommandPrefix = ''
142145

143-
}
144-
146+
}

src/ResourceManager/EventHub/ChangeLog.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,26 @@
1919
-->
2020
## Current Release
2121

22+
* Added below new commands for Geo Disaster Recovery operations.
23+
-Creating a new Alias(Disaster Recovery configuration):
24+
- New-AzureRmEventHubGeoDRConfiguration [-ResourceGroupName] <String> [-Namespace] <String> [-Name] <String> [-PartnerNamespace] <String> [-WhatIf] [-Confirm]
25+
-Retrieve Alias(Disaster Recovery configuration) :
26+
- Get-AzureRmEventHubGeoDRConfiguration [-ResourceGroupName] <String> [-Namespace] <String> [[-Name] <String>]
27+
-Disabling the Disaster Recovery and stops replicating changes from primary to secondary namespaces
28+
- Set-AzureRmEventHubGeoDRConfigurationBreakPair [-ResourceGroupName] <String> [-Namespace] <String> [-Name] <String>
29+
-Invoking Disaster Recovery failover and reconfigure the alias to point to the secondary namespace
30+
- Set-AzureRmEventHubGeoDRConfigurationFailOver [-ResourceGroupName] <String> [-Namespace] <String> [-Name] <String>
31+
-Deleting an Alias(Disaster Recovery configuration)
32+
- Remove-AzureRmEventHubGeoDRConfiguration [-ResourceGroupName] <String> [-Namespace] <String> [-Name] <String> [-WhatIf] [-Confirm]
33+
34+
* Added below new commands for checking the Namespace Name and GeoDr Configuration Name - Alias availability.
35+
-Check the Availability of Namespace name or Alias(Disaster Recovery configuration) name:
36+
- Test-AzureRmEventHubName [-ResourceGroupName] <String> [-Namespace] <String> [-AliasName] <String>
37+
2238
## Version 0.5.1
2339
* Added Location Completer to -Location parameters allowing tab completion through valid Locations
2440
* Added ResourceGroup Completer to -ResourceGroup parameters allowing tab completion through resource groups in current subscription
25-
41+
2642
## Version 0.5.0
2743
* NOTE: This is a breaking change release. Please see the migration guide (https://aka.ms/azps-migration-guide) for a full list of breaking changes introduced.
2844
* Add support for online help

src/ResourceManager/EventHub/Commands.EventHub.Test/Commands.EventHubs.Test.csproj

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.2\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.Management.EventHub, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
58-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.EventHub.2.0.0\lib\net452\Microsoft.Azure.Management.EventHub.dll</HintPath>
58+
<SpecificVersion>False</SpecificVersion>
59+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.EventHub.2.0.3\lib\net452\Microsoft.Azure.Management.EventHub.dll</HintPath>
5960
<Private>True</Private>
6061
</Reference>
6162
<Reference Include="Microsoft.Azure.Test.HttpRecorder">
@@ -68,11 +69,11 @@
6869
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
6970
</Reference>
7071
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
72+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7273
<Private>True</Private>
7374
</Reference>
7475
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.7\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
76+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.10\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
7677
<Private>True</Private>
7778
</Reference>
7879
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -136,6 +137,7 @@
136137
</ItemGroup>
137138
<ItemGroup>
138139
<Compile Include="ScenarioTests\ConsumerGroups.cs" />
140+
<Compile Include="ScenarioTests\DRConfigurations.cs" />
139141
<Compile Include="ScenarioTests\Namespace.cs" />
140142
<Compile Include="ScenarioTests\EventHubsController.cs" />
141143
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -161,12 +163,12 @@
161163
<None Include="Resources\NewEventHub.json">
162164
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
163165
</None>
164-
<None Include="ScenarioTests\Common.ps1">
165-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
166-
</None>
167166
<None Include="ScenarioTests\ConsumerGroupsTests.ps1">
168167
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
169168
</None>
169+
<None Include="ScenarioTests\DRConfigurationTests.ps1">
170+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
171+
</None>
170172
<None Include="ScenarioTests\NamespaceTests.ps1">
171173
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
172174
</None>
@@ -176,6 +178,9 @@
176178
<None Include="SessionRecords\Microsoft.Azure.Commands.EventHub.Test.ScenarioTests.ConsumerGroupsTests\ConsumerGroupsCRUD.json">
177179
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
178180
</None>
181+
<None Include="SessionRecords\Microsoft.Azure.Commands.EventHub.Test.ScenarioTests.DRConfigurationTests\DRConfigurationsCURD.json">
182+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
183+
</None>
179184
<None Include="SessionRecords\Microsoft.Azure.Commands.EventHub.Test.ScenarioTests.EventHubsTests\EventHubsAuthorizationRulesCRUD.json">
180185
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
181186
</None>

src/ResourceManager/EventHub/Commands.EventHub.Test/ScenarioTests/Common.ps1

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/ResourceManager/EventHub/Commands.EventHub.Test/ScenarioTests/ConsumerGroupsTests.ps1

Lines changed: 20 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,55 +12,20 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15-
<#
16-
.SYNOPSIS
17-
Get valid resource group name
18-
#>
19-
function Get-ResourceGroupName
20-
{
21-
return "RGName-" + (getAssetName)
22-
}
23-
24-
<#
25-
.SYNOPSIS
26-
Get valid EventHub name
27-
#>
28-
function Get-EventHubName
29-
{
30-
return "EventHub-" + (getAssetName)
31-
}
32-
33-
<#
34-
.SYNOPSIS
35-
Get ConsumerGroup name
36-
#>
37-
function Get-ConsumerGroupName
38-
{
39-
return "ConsumerGroup-" + (getAssetName)
40-
}
41-
42-
<#
43-
.SYNOPSIS
44-
Get valid Namespace name
45-
#>
46-
function Get-NamespaceName
47-
{
48-
return "Namespace-" + (getAssetName)
49-
}
50-
5115
<#
5216
.SYNOPSIS
5317
Tests New Parameter for ConsumerGroup Create List Remove operations.
5418
#>
19+
5520
function ConsumerGroupsTests
5621
{ # Setup
5722

5823

5924
$location = Get-Location
60-
$resourceGroupName = Get-ResourceGroupName
61-
$namespaceName = Get-NamespaceName
62-
$eventHubName = Get-EventHubName
63-
$consumerGroupName = Get-ConsumerGroupName
25+
$resourceGroupName = getAssetName "RSG"
26+
$namespaceName = getAssetName "Namespace-"
27+
$eventHubName = getAssetName "EventHub-"
28+
$consumerGroupName = getAssetName "ConsumerGroup-"
6429

6530
Write-Debug " Create resource group"
6631
Write-Debug " Resource Group Name : $resourceGroupName"
@@ -71,9 +36,8 @@ function ConsumerGroupsTests
7136
$result = New-AzureRmEventHubNamespace -ResourceGroup $resourceGroupName -Name $namespaceName -Location $location
7237

7338
Write-Debug " Get the created namespace within the resource group"
74-
$createdNamespace = Get-AzureRmEventHubNamespace -ResourceGroup $resourceGroupName -Name $namespaceName
75-
76-
Assert-True {$createdNamespace.Name -eq $namespaceName} "Namespace created earlier is not found."
39+
$createdNamespace = Get-AzureRmEventHubNamespace -ResourceGroup $resourceGroupName -Name $namespaceName
40+
Assert-AreEqual $createdNamespace.Name $namespaceName "New Namespace: Namespace created earlier is not found."
7741

7842
Write-Debug " Create new eventHub "
7943
$msgRetentionInDays = 3
@@ -82,29 +46,34 @@ function ConsumerGroupsTests
8246

8347
Write-Debug " Get the created eventHub "
8448
$createdEventHub = Get-AzureRmEventHub -ResourceGroup $resourceGroupName -Namespace $namespaceName -Name $result.Name
85-
86-
$createdEventHub = Get-AzureRmEventHub -ResourceGroup $resourceGroupName -Namespace $namespaceName -Name $eventHubName
87-
Assert-True {$createdEventHub.Name -eq $eventHubName} "Namespace created earlier is not found."
49+
Assert-AreEqual $createdEventHub.Name $eventHubName "Get Namespace: Namespace created earlier is not found."
8850

8951
Write-Debug " Create a new ConsumerGroup "
9052
$result_ConsumerGroup = New-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $eventHubName -Name $consumerGroupName
53+
Assert-AreEqual $result_ConsumerGroup.Name $consumerGroupName "New ConsumerGroup: ConsumerGroup created earlier is not found."
9154

9255
Write-Debug " Get created ConsumerGroup "
93-
$CreatedConsumerGroup = Get-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $eventHubName -Name $result_ConsumerGroup.Name
56+
$GetConsumerGroup = Get-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $eventHubName -Name $result_ConsumerGroup.Name
57+
Assert-AreEqual $GetConsumerGroup.Name $consumerGroupName "Get ConsumerGroup: ConsumerGroup created earlier is not found."
9458

9559
Write-Debug " Get all created ConsumerGroup "
96-
$CreatedConsumerGroups = Get-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $result.Name
97-
60+
$ListConsumerGroups = Get-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $result.Name
61+
Assert-True { $ListConsumerGroups.Count -ge 0 } "List ConsumerGroup: ConsumerGroup created earlier is not found."
62+
9863
# Cleanup
9964
Write-Debug " Delete created ConsumerGroup "
100-
Remove-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $result.Name -Name $CreatedConsumerGroup.Name
65+
Remove-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $result.Name -Name $GetConsumerGroup.Name
66+
67+
Write-Debug " check the if consumergroup is deleted"
68+
$ListConsumerGroups_afterdelete = Get-AzureRmEventHubConsumerGroup -ResourceGroup $resourceGroupName -Namespace $namespaceName -EventHub $result.Name
69+
Assert-True { $ListConsumerGroups_afterdelete.Count -lt 2 } "List ConsumerGroup: ConsumerGroup deleted earlier is found."
10170

10271
Write-Debug " Delete the EventHub"
10372
$delete1 = Remove-AzureRmEventHub -ResourceGroup $resourceGroupName -Namespace $namespaceName -Name $result.Name
10473

10574
Write-Debug " Delete namespaces"
10675
Remove-AzureRmEventHubNamespace -ResourceGroup $resourceGroupName -Name $namespaceName
10776

108-
Write-Debug " Delete resourcegroup"
77+
Write-Debug " Delete resourcegroup"
10978
Remove-AzureRmResourceGroup -Name $resourceGroupName -Force
11079
}

0 commit comments

Comments
 (0)