|
| 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