Skip to content

Commit de96d33

Browse files
authored
Add generated cmdlets for new RedisEnterpriseCache service (#13498)
* Add Redis Enterprise Cache * Add unit tests, include examples, and various other updates. * Set DatabaseName to default * Hide private link-related cmdlets because the Az.Network module will be used intead. * Include Database in Cluster object * Update per comments from PR * Remove secrets for CredScan * Revert whitespace change * Try to suppress CredScan false positives * Add example for get operation status * Add more tests and recordings * Suppress CredScan for test passwords
1 parent ef43fea commit de96d33

File tree

62 files changed

+6875
-0
lines changed

Some content is hidden

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

62 files changed

+6875
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

src/RedisEnterpriseCache/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
bin
2+
obj
3+
.vs
4+
generated
5+
internal
6+
exports
7+
tools
8+
custom/*.psm1
9+
test/*-TestResults.xml
10+
/*.ps1
11+
/*.ps1xml
12+
/*.psm1
13+
/*.snk
14+
/*.csproj
15+
/*.nuspec
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@{
2+
GUID = '0b3b43eb-9078-4d06-8c79-d156a1410906'
3+
RootModule = './Az.RedisEnterpriseCache.psm1'
4+
ModuleVersion = '0.1.0'
5+
CompatiblePSEditions = 'Core', 'Desktop'
6+
Author = 'Microsoft Corporation'
7+
CompanyName = 'Microsoft Corporation'
8+
Copyright = 'Microsoft Corporation. All rights reserved.'
9+
Description = 'Microsoft Azure PowerShell: RedisEnterpriseCache cmdlets'
10+
PowerShellVersion = '5.1'
11+
DotNetFrameworkVersion = '4.7.2'
12+
RequiredAssemblies = './bin/Az.RedisEnterpriseCache.private.dll'
13+
FormatsToProcess = './Az.RedisEnterpriseCache.format.ps1xml'
14+
FunctionsToExport = 'Export-AzRedisEnterpriseCacheDatabase', 'Get-AzRedisEnterpriseCache', 'Get-AzRedisEnterpriseCacheDatabase', 'Get-AzRedisEnterpriseCacheDatabaseKey', 'Get-AzRedisEnterpriseCacheOperationStatus', 'Import-AzRedisEnterpriseCacheDatabase', 'New-AzRedisEnterpriseCache', 'New-AzRedisEnterpriseCacheDatabaseKey', 'Remove-AzRedisEnterpriseCache', 'Update-AzRedisEnterpriseCache', 'Update-AzRedisEnterpriseCacheDatabase', '*'
15+
AliasesToExport = '*'
16+
PrivateData = @{
17+
PSData = @{
18+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'RedisEnterpriseCache'
19+
LicenseUri = 'https://aka.ms/azps-license'
20+
ProjectUri = 'https://github.com/Azure/azure-powershell'
21+
ReleaseNotes = ''
22+
}
23+
}
24+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20201001Preview
2+
{
3+
public partial class Cluster
4+
{
5+
public System.Collections.Hashtable Database { get; set; }
6+
}
7+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<#
2+
.Synopsis
3+
Exports a database file from target database.
4+
.Description
5+
Exports a database file from target database.
6+
.Example
7+
[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Invalid SAS token")]
8+
PS C:\> Export-AzRedisEnterpriseCacheDatabase -Name "MyCache" -ResourceGroupName "MyGroup" -SasUri "https://mystorageaccount.blob.core.windows.net/mycontainer?sp=rwdl&se=2020-09-02T11:17:15Z&sv=2019-12-12&sr=c&sig=Us%2FGshOUTKCSzTOi8dLtt1to2L32rcDr3Nn0WFFMdDM%3D;mystoragekey"
9+
10+
.Outputs
11+
System.Boolean
12+
.Link
13+
https://docs.microsoft.com/en-us/powershell/module/az.redisenterprisecache/export-azredisenterprisecachedatabase
14+
#>
15+
function Export-AzRedisEnterpriseCacheDatabase {
16+
[OutputType([System.Boolean])]
17+
[CmdletBinding(DefaultParameterSetName='ExportExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
18+
param(
19+
[Parameter(Mandatory)]
20+
[Alias('Name')]
21+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Path')]
22+
[System.String]
23+
# The name of the RedisEnterprise cluster.
24+
${ClusterName},
25+
26+
[Parameter(Mandatory)]
27+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Path')]
28+
[System.String]
29+
# The name of the resource group.
30+
${ResourceGroupName},
31+
32+
[Parameter()]
33+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Path')]
34+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
35+
[System.String]
36+
# Gets subscription credentials which uniquely identify the Microsoft Azure subscription.
37+
# The subscription ID forms part of the URI for every service call.
38+
${SubscriptionId},
39+
40+
[Parameter(Mandatory)]
41+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Body')]
42+
[System.String]
43+
# SAS Uri for the target directory to export to
44+
${SasUri},
45+
46+
[Parameter()]
47+
[Alias('AzureRMContext', 'AzureCredential')]
48+
[ValidateNotNull()]
49+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Azure')]
50+
[System.Management.Automation.PSObject]
51+
# The credentials, account, tenant, and subscription used for communication with Azure.
52+
${DefaultProfile},
53+
54+
[Parameter()]
55+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
56+
[System.Management.Automation.SwitchParameter]
57+
# Run the command as a job
58+
${AsJob},
59+
60+
[Parameter(DontShow)]
61+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
62+
[System.Management.Automation.SwitchParameter]
63+
# Wait for .NET debugger to attach
64+
${Break},
65+
66+
[Parameter(DontShow)]
67+
[ValidateNotNull()]
68+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
69+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.SendAsyncStep[]]
70+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
71+
${HttpPipelineAppend},
72+
73+
[Parameter(DontShow)]
74+
[ValidateNotNull()]
75+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
76+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.SendAsyncStep[]]
77+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
78+
${HttpPipelinePrepend},
79+
80+
[Parameter()]
81+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
82+
[System.Management.Automation.SwitchParameter]
83+
# Run the command asynchronously
84+
${NoWait},
85+
86+
[Parameter()]
87+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
88+
[System.Management.Automation.SwitchParameter]
89+
# Returns true when the command succeeds
90+
${PassThru},
91+
92+
[Parameter(DontShow)]
93+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
94+
[System.Uri]
95+
# The URI for the proxy server to use
96+
${Proxy},
97+
98+
[Parameter(DontShow)]
99+
[ValidateNotNull()]
100+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
101+
[System.Management.Automation.PSCredential]
102+
# Credentials for a proxy server to use for the remote call
103+
${ProxyCredential},
104+
105+
[Parameter(DontShow)]
106+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
107+
[System.Management.Automation.SwitchParameter]
108+
# Use the default credentials for the proxy
109+
${ProxyUseDefaultCredentials}
110+
)
111+
112+
process {
113+
$null = $PSBoundParameters.Add("DatabaseName", "default")
114+
Az.RedisEnterpriseCache.internal\Export-AzRedisEnterpriseCacheDatabase @PSBoundParameters
115+
}
116+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<#
2+
.Synopsis
3+
Gets information about a RedisEnterprise cluster and its associated database
4+
.Description
5+
Gets information about a RedisEnterprise cluster and its associated database
6+
.Example
7+
PS C:\> Get-AzRedisEnterpriseCache -ResourceGroupName "MyGroup" -Name "MyCache"
8+
9+
Location Name Type Zone Database
10+
-------- ---- ---- ---- --------
11+
West US MyCache Microsoft.Cache/redisEnterprise {default}
12+
13+
.Example
14+
PS C:\> Get-AzRedisEnterpriseCache -ResourceGroupName "MyGroup"
15+
16+
Location Name Type Zone Database
17+
-------- ---- ---- ---- --------
18+
East US MyCache1 Microsoft.Cache/redisEnterprise {default}
19+
East US MyCache2 Microsoft.Cache/redisEnterprise {1, 2, 3} {default}
20+
21+
.Outputs
22+
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20201001Preview.ICluster
23+
.Link
24+
https://docs.microsoft.com/en-us/powershell/module/az.redisenterprisecache/get-azredisenterprisecache
25+
#>
26+
27+
function Get-AzRedisEnterpriseCache {
28+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20201001Preview.ICluster])]
29+
[CmdletBinding(PositionalBinding=$false)]
30+
param(
31+
[Parameter(Mandatory, HelpMessage='The name of the resource group.')]
32+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Path')]
33+
[System.String]
34+
# The name of the resource group.
35+
${ResourceGroupName},
36+
37+
[Parameter(HelpMessage='The name of the RedisEnterprise cluster.')]
38+
[Alias('Name')]
39+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Path')]
40+
[System.String]
41+
# The name of the RedisEnterprise cluster.
42+
${ClusterName},
43+
44+
[Parameter(HelpMessage='Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.')]
45+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Path')]
46+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
47+
[System.String[]]
48+
# Gets subscription credentials which uniquely identify the Microsoft Azure subscription.
49+
# The subscription ID forms part of the URI for every service call.
50+
${SubscriptionId},
51+
52+
[Parameter(HelpMessage='The credentials, account, tenant, and subscription used for communication with Azure.')]
53+
[Alias('AzureRMContext', 'AzureCredential')]
54+
[ValidateNotNull()]
55+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Azure')]
56+
[System.Management.Automation.PSObject]
57+
# The credentials, account, tenant, and subscription used for communication with Azure.
58+
${DefaultProfile},
59+
60+
[Parameter(DontShow, HelpMessage='Wait for .NET debugger to attach')]
61+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
62+
[System.Management.Automation.SwitchParameter]
63+
# Wait for .NET debugger to attach
64+
${Break},
65+
66+
[Parameter(DontShow, HelpMessage='SendAsync Pipeline Steps to be appended to the front of the pipeline')]
67+
[ValidateNotNull()]
68+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
69+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.SendAsyncStep[]]
70+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
71+
${HttpPipelineAppend},
72+
73+
[Parameter(DontShow, HelpMessage='SendAsync Pipeline Steps to be prepended to the front of the pipeline')]
74+
[ValidateNotNull()]
75+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
76+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.SendAsyncStep[]]
77+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
78+
${HttpPipelinePrepend},
79+
80+
[Parameter(DontShow, HelpMessage='The URI for the proxy server to use')]
81+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
82+
[System.Uri]
83+
# The URI for the proxy server to use
84+
${Proxy},
85+
86+
[Parameter(DontShow, HelpMessage='Credentials for a proxy server to use for the remote call')]
87+
[ValidateNotNull()]
88+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
89+
[System.Management.Automation.PSCredential]
90+
# Credentials for a proxy server to use for the remote call
91+
${ProxyCredential},
92+
93+
[Parameter(DontShow, HelpMessage='Use the default credentials for the proxy')]
94+
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Runtime')]
95+
[System.Management.Automation.SwitchParameter]
96+
# Use the default credentials for the proxy
97+
${ProxyUseDefaultCredentials}
98+
)
99+
100+
process {
101+
if ($PSBoundParameters.ContainsKey("ClusterName"))
102+
{
103+
$cluster = Az.RedisEnterpriseCache.internal\Get-AzRedisEnterpriseCache @PSBoundParameters
104+
105+
$databaseList = Az.RedisEnterpriseCache.internal\Get-AzRedisEnterpriseCacheDatabase @PSBoundParameters
106+
$cluster.Database = @{}
107+
foreach ($database in $databaseList)
108+
{
109+
$cluster.Database.Add($database.Name, $database)
110+
}
111+
112+
return $cluster
113+
}
114+
else
115+
{
116+
$clusterList = Az.RedisEnterpriseCache.internal\Get-AzRedisEnterpriseCache @PSBoundParameters
117+
118+
foreach ($cluster in $clusterList)
119+
{
120+
$GetPSBoundParameters = @{} + $PSBoundParameters
121+
$null = $GetPSBoundParameters.Add("ClusterName", $cluster.Name)
122+
$databaseList = Az.RedisEnterpriseCache.internal\Get-AzRedisEnterpriseCacheDatabase @GetPSBoundParameters
123+
$cluster.Database = @{}
124+
foreach ($database in $databaseList)
125+
{
126+
$cluster.Database.Add($database.Name, $database)
127+
}
128+
}
129+
130+
return $clusterList
131+
}
132+
}
133+
}

0 commit comments

Comments
 (0)