|
| 1 | +To add breaking changes and preview messages for cmdlets, there are two scenarios to handle. |
| 2 | + |
| 3 | +- For auto gen cmdlets |
| 4 | +- For customized cmdlets |
| 5 | + |
| 6 | +# For auto gen cmdlets |
| 7 | + |
| 8 | +Breaking changes and preview messages for auto gen cmdlets are added through directives in readme.md. And following are some common cases. |
| 9 | + |
| 10 | +## Case 1 — Module is deprecated |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +```yaml |
| 15 | +- where: |
| 16 | + verb: (.*) |
| 17 | + set: |
| 18 | + breaking-change: |
| 19 | + deprecated-by-version: 5.0.0 |
| 20 | + change-effective-date: 2055/10/30 |
| 21 | +``` |
| 22 | + |
| 23 | +## Case 2 — Breaking change for a cmdlet |
| 24 | + |
| 25 | +```yaml |
| 26 | +- where: |
| 27 | + verb: New |
| 28 | + subject: VNetPeering |
| 29 | + set: |
| 30 | + breaking-change: |
| 31 | + replacement-cmdlet: New-AzNewVNetPeering |
| 32 | + deprecated-by-version: 5.0.0 |
| 33 | + change-effective-date: 2022/05/30 |
| 34 | +``` |
| 35 | + |
| 36 | +## Case 3 — Breaking change for multiple cmdlets |
| 37 | + |
| 38 | +```yaml |
| 39 | +- where: |
| 40 | + subject: VNetPeering |
| 41 | + set: |
| 42 | + breaking-change: |
| 43 | + replacement-cmdlet: $.replace("VNetPeering", "VNewNetPeering") |
| 44 | + deprecated-by-version: 5.0.0 |
| 45 | + change-effective-date: 2022/05/30 |
| 46 | +``` |
| 47 | + |
| 48 | +## Case 4 — Breaking change for an output type |
| 49 | + |
| 50 | +```yaml |
| 51 | +- where: |
| 52 | + verb: New |
| 53 | + subject: VNetPeering |
| 54 | + set: |
| 55 | + breaking-change: |
| 56 | + deprecated-cmdlet-output-type: oldtype |
| 57 | + replacement-cmdlet-output-type: newtype |
| 58 | + deprecated-output-properties: |
| 59 | + - propertyA |
| 60 | + - PropertyB |
| 61 | + new-output-properties: |
| 62 | + - PropertyC |
| 63 | + - PropertyD |
| 64 | + change-description: This is a custom message for the change. |
| 65 | + deprecated-by-version: 5.0.0 |
| 66 | + change-effective-date: 2022/05/11 |
| 67 | +``` |
| 68 | + |
| 69 | +## Case 5 — Breaking change for parameter sets(variants) |
| 70 | + |
| 71 | +```yaml |
| 72 | +- where: |
| 73 | + verb: Remove |
| 74 | + subject: VNetPeering |
| 75 | + variant: Delete |
| 76 | + set: |
| 77 | + breaking-change: |
| 78 | + deprecated-by-version: 5.0.0 |
| 79 | + change-efective-date: 2022/05/30 |
| 80 | +``` |
| 81 | + |
| 82 | +## Case 6 — Breaking change for a parameter |
| 83 | + |
| 84 | +```yaml |
| 85 | +- where: |
| 86 | + parameter-name: Sku |
| 87 | + set: |
| 88 | + breaking-change: |
| 89 | + old-parameter-type: int |
| 90 | + new-parameter-type: boolean |
| 91 | + become-mandatory: true |
| 92 | + change-description: This is a custom message for the change. |
| 93 | + deprecated-by-version: 5.0.0 |
| 94 | + change-efective-date: 2022/05/30 |
| 95 | +``` |
| 96 | + |
| 97 | +## Case 7 — Preview message |
| 98 | + |
| 99 | +```yaml |
| 100 | +- where: |
| 101 | + verb: New |
| 102 | + subject: VNetPeering |
| 103 | + set: |
| 104 | + preview-message: This is a test preview message. |
| 105 | +``` |
| 106 | + |
| 107 | +# For customized cmdlets |
| 108 | + |
| 109 | +To add breaking changes or preview messages for a customized cmdlets, you will need to add related attributes in code directly. And following are some common cases. |
| 110 | + |
| 111 | +**Note: For Case 1/2/3/5, the attributes are applied on the functions. For case 5, the attribute is applied in the parameter. And these examples are based on the databricks module, so you will need to replace it with your module name.** |
| 112 | + |
| 113 | +## Case 1 — Breaking change for a cmdlet |
| 114 | + |
| 115 | +```csharp |
| 116 | +[Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.CmdletBreakingChangeAttribute("4.0", "2022/05/30", ReplacementCmdletName = 'replace-xxx') |
| 117 | +``` |
| 118 | + |
| 119 | +## Case 2 — Breaking change for parameter sets(variants) |
| 120 | + |
| 121 | +```csharp |
| 122 | +[Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.ParameterSetBreakingChangeAttribute(("parametersetname1", "parametersetname2"), "4.0", "2022/05/30")] |
| 123 | +``` |
| 124 | + |
| 125 | +## Case 3 — Breaking change for an output type |
| 126 | + |
| 127 | +```csharp |
| 128 | +[Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.OutputBreakingChange("oldtype", "5.0.0", "2022/05/11", ReplacementCmdletOutputType = "newtype", DeprecatedOutputProperties = ("propertyA", "PropertyB"), NewOutputProperties = ("PropertyC", "PropertyD"))] |
| 129 | +``` |
| 130 | + |
| 131 | +## Case 4 — Breaking change for a parameter |
| 132 | + |
| 133 | +```csharp |
| 134 | +[Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.ParameterBreakingChangeAttribute("ResourceGroupName", "4.1", "2028/06/18")] |
| 135 | +``` |
| 136 | + |
| 137 | +## Case 5 — Preview message |
| 138 | + |
| 139 | +```csharp |
| 140 | +[Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.PreviewMessageAttribute("This is a preview version")] |
| 141 | +``` |
0 commit comments