Skip to content

Commit

Permalink
Add 2024-06-01-preview for redis enterprise (#25460)
Browse files Browse the repository at this point in the history
* Add 2024-06-01-preview for redis enterprise

* Update New-AzRedisEnterpriseCache.ps1

* update files aftre building modules

* Add test recordings

* Update examples of force unlink and upgrade db

* fix SKU naming

* fix examples

---------

Co-authored-by: Yabo Hu <yabhu@microsoft.com>
  • Loading branch information
revanthballa1188 and VeryEarly authored Sep 5, 2024
1 parent 1c2862c commit a5ac1e5
Show file tree
Hide file tree
Showing 52 changed files with 2,737 additions and 2,966 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.RedisEnterpriseCache.private.dll'
FormatsToProcess = './Az.RedisEnterpriseCache.format.ps1xml'
FunctionsToExport = 'Export-AzRedisEnterpriseCache', 'Get-AzRedisEnterpriseCache', 'Get-AzRedisEnterpriseCacheDatabase', 'Get-AzRedisEnterpriseCacheKey', 'Get-AzRedisEnterpriseCacheOperationStatus', 'Import-AzRedisEnterpriseCache', 'Invoke-AzRedisEnterpriseCacheDatabaseFlush', 'Invoke-AzRedisEnterpriseCacheForceDatabaseUnlink', 'New-AzRedisEnterpriseCache', 'New-AzRedisEnterpriseCacheDatabase', 'New-AzRedisEnterpriseCacheKey', 'Remove-AzRedisEnterpriseCache', 'Remove-AzRedisEnterpriseCacheDatabase', 'Update-AzRedisEnterpriseCache', 'Update-AzRedisEnterpriseCacheDatabase', '*'
FunctionsToExport = 'Export-AzRedisEnterpriseCache', 'Get-AzRedisEnterpriseCache', 'Get-AzRedisEnterpriseCacheDatabase', 'Get-AzRedisEnterpriseCacheKey', 'Get-AzRedisEnterpriseCacheOperationStatus', 'Import-AzRedisEnterpriseCache', 'Invoke-AzRedisEnterpriseCacheDatabaseFlush', 'Invoke-AzRedisEnterpriseCacheForceDatabaseLinkToReplicationGroup', 'Invoke-AzRedisEnterpriseCacheForceDatabaseUnlink', 'New-AzRedisEnterpriseCache', 'New-AzRedisEnterpriseCacheDatabase', 'New-AzRedisEnterpriseCacheKey', 'Remove-AzRedisEnterpriseCache', 'Remove-AzRedisEnterpriseCacheDatabase', 'Update-AzRedisEnterpriseCache', 'Update-AzRedisEnterpriseCacheDatabase', 'Update-AzRedisEnterpriseCacheDatabaseDbRedisVersion', '*'
AliasesToExport = 'Export-AzRedisEnterpriseCacheDatabase', 'Get-AzRedisEnterpriseCacheDatabaseKey', 'Get-AzRedisEnterpriseCacheAccessKey', 'Import-AzRedisEnterpriseCacheDatabase', 'New-AzRedisEnterpriseCacheDatabaseKey', 'New-AzRedisEnterpriseCacheAccessKey', '*'
PrivateData = @{
PSData = @{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
This directory contains the PowerShell module for the RedisEnterpriseCache service.

---
## Status
[![Az.RedisEnterpriseCache](https://img.shields.io/powershellgallery/v/Az.RedisEnterpriseCache.svg?style=flat-square&label=Az.RedisEnterpriseCache "Az.RedisEnterpriseCache")](https://www.powershellgallery.com/packages/Az.RedisEnterpriseCache/)

## Info
- Modifiable: yes
- Generated: all
Expand All @@ -17,7 +14,7 @@ This directory contains the PowerShell module for the RedisEnterpriseCache servi
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

## Module Requirements
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
Expand All @@ -35,12 +32,12 @@ In this directory, run AutoRest:
> see https://aka.ms/autorest
``` yaml
commit: aef78a6d0f0bc49b42327621fc670200d7545816
commit: edf14cc0a577f6b9c4e3ce018cec0c383e64b7b0
require:
- $(this-folder)/../../readme.azure.noprofile.md
# lock the commit
input-file:
- $(repo)/specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/redisenterprise.json
- $(repo)/specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-06-01-preview/redisenterprise.json

module-version: 1.0.0
title: RedisEnterpriseCache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview
namespace Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview
{
public partial class Cluster
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ West US MyCache3 Microsoft.Cache/redisEnterprise {default}
Central US MyCache4 Microsoft.Cache/redisEnterprise {1, 2, 3} {default}
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.ICluster
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.ICluster
.Link
https://learn.microsoft.com/powershell/module/az.redisenterprisecache/get-azredisenterprisecache
#>

function Get-AzRedisEnterpriseCache {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.ICluster])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.ICluster])]
[CmdletBinding(DefaultParameterSetName='ListBySubscriptionId', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Get', Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Name Type
default Microsoft.Cache/redisEnterprise/databases
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IDatabase
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IDatabase
.Link
https://learn.microsoft.com/powershell/module/az.redisenterprisecache/get-azredisenterprisecachedatabase
#>
function Get-AzRedisEnterpriseCacheDatabase {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IDatabase])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IDatabase])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
param(
[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ PrimaryKey SecondaryKey
primary-key secondary-key
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IAccessKeys
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IAccessKeys
.Link
https://learn.microsoft.com/powershell/module/az.redisenterprisecache/get-azredisenterprisecachekey
#>
function Get-AzRedisEnterpriseCacheKey {
[Alias('Get-AzRedisEnterpriseCacheDatabaseKey', 'Get-AzRedisEnterpriseCacheAccessKey')]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IAccessKeys])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IAccessKeys])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Location Name Type Zone Database
East US MyCache Microsoft.Cache/redisEnterprise {}
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.ICluster
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.ICluster
.Notes
COMPLEX PARAMETER PROPERTIES
Expand All @@ -54,7 +54,7 @@ MODULE <IModule[]>: Optional set of redis modules to enable in this database - m
https://learn.microsoft.com/powershell/module/az.redisenterprisecache/new-azredisenterprisecache
#>
function New-AzRedisEnterpriseCache {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.ICluster])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.ICluster])]
[CmdletBinding(DefaultParameterSetName='CreateClusterWithDatabase', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -83,7 +83,7 @@ function New-AzRedisEnterpriseCache {
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Support.SkuName]
# The type of Redis Enterprise cluster to deploy.
# Allowed values: Enterprise_E10, Enterprise_E20, Enterprise_E50, Enterprise_E100, EnterpriseFlash_F300, EnterpriseFlash_F700, EnterpriseFlash_F1500
# Allowed values: Enterprise_E1, Enterprise_E5, Enterprise_E10, Enterprise_E20, Enterprise_E50, Enterprise_E100, Enterprise_E200, Enterprise_E400,EnterpriseFlash_F300, EnterpriseFlash_F700, EnterpriseFlash_F1500
${Sku},

[Parameter()]
Expand All @@ -110,14 +110,14 @@ function New-AzRedisEnterpriseCache {

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api30.ITrackedResourceTags]))]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20.ITrackedResourceTags]))]
[System.Collections.Hashtable]
# Cluster resource tags.
${Tag},

[Parameter(ParameterSetName='CreateClusterWithDatabase')]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IModule[]]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IModule[]]
# Optional set of redis modules to enable in this database - modules can only be added at create time.
# To construct, see NOTES section for MODULE properties and create a hash table.
${Module},
Expand Down Expand Up @@ -154,7 +154,7 @@ function New-AzRedisEnterpriseCache {
[Parameter(ParameterSetName='CreateClusterWithDatabase')]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.ILinkedDatabase[]]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.ILinkedDatabase[]]
# List of database resources to link with this database
# To construct, see NOTES section for GEOREPLICATIONLINKEDDATABASE properties and create a hash table.
${LinkedDatabase},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ default Microsoft.Cache/redisEnterprise/databases
PS C:\> New-AzRedisEnterpriseCacheDatabase -Name "MyCache2" -ResourceGroupName "MyGroup" -ClientProtocol "Encrypted" -EvictionPolicy "NoEviction" -ClusteringPolicy "EnterpriseCluster" -GroupNickname "GroupNickname" -LinkedDatabase '{id:"/subscriptions/6b9ac7d2-7f6d-4de4-962c-43fda44bc3f2/resourceGroups/MyGroup/providers/Microsoft.Cache/redisEnterprise/MyCache/databases/default"}','{id:"/subscriptions/sub1/resourceGroups/MyGroup/providers/Microsoft.Cache/redisEnterprise/MyCache2/databases/default"}'
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IDatabase
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IDatabase
.Notes
COMPLEX PARAMETER PROPERTIES
Expand All @@ -53,7 +53,7 @@ MODULE <IModule[]>: Optional set of redis modules to enable in this database - m
https://learn.microsoft.com/powershell/module/az.redisenterprisecache/new-azredisenterprisecachedatabase
#>
function New-AzRedisEnterpriseCacheDatabase {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IDatabase])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IDatabase])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand All @@ -72,7 +72,7 @@ function New-AzRedisEnterpriseCacheDatabase {

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IModule[]]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IModule[]]
# Optional set of redis modules to enable in this database - modules can only be added at create time.
# To construct, see NOTES section for MODULE properties and create a hash table.
${Module},
Expand Down Expand Up @@ -109,7 +109,7 @@ function New-AzRedisEnterpriseCacheDatabase {
[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.ILinkedDatabase[]]
[Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.ILinkedDatabase[]]
# List of database resources to link with this database
# To construct, see NOTES section for GEOREPLICATIONLINKEDDATABASE properties and create a hash table.
${LinkedDatabase},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ PrimaryKey SecondaryKey
primary-key new-secondary-key
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IAccessKeys
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IAccessKeys
.Link
https://learn.microsoft.com/powershell/module/az.redisenterprisecache/new-azredisenterprisecachekey
#>
function New-AzRedisEnterpriseCacheKey {
[Alias('New-AzRedisEnterpriseCacheDatabaseKey', 'New-AzRedisEnterpriseCacheAccessKey')]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IAccessKeys])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IAccessKeys])]
[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For `Az.RedisEnterpriseCache` to use custom cmdlets, it does this two different

For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.RedisEnterpriseCache.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder.

For script cmdlets, these are loaded via the `Az.RedisEnterpriseCache.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
For script cmdlets, these are loaded via the `Az.RedisEnterpriseCache.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.

## Purpose
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
Expand All @@ -32,10 +32,10 @@ These provide functionality to our HTTP pipeline and other useful features. In s
### Attributes
For processing the cmdlets, we've created some additional attributes:
- `Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.DescriptionAttribute`
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
- `Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.RedisEnterpriseCache`.
- `Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.RedisEnterpriseCache`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder.
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.RedisEnterpriseCache`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ default Microsoft.Cache/redisEnterprise/databases
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.IRedisEnterpriseCacheIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IDatabase
Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IDatabase
.Notes
COMPLEX PARAMETER PROPERTIES
Expand All @@ -59,7 +59,7 @@ MODULE <IModule[]>: Optional set of redis modules to enable in this database - m
https://learn.microsoft.com/powershell/module/az.redisenterprisecache/update-azredisenterprisecachedatabase
#>
function Update-AzRedisEnterpriseCacheDatabase {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20230301Preview.IDatabase])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.RedisEnterpriseCache.Models.Api20240601Preview.IDatabase])]
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
Expand Down
Loading

0 comments on commit a5ac1e5

Please sign in to comment.