Skip to content

Commit 6e4bdaa

Browse files
author
Henry Dai
committed
Merge remote-tracking branch 'other-repo/henrydai/ImplementCRUDforChangeState' into henrydai/implementChangeStateCRUD0901
2 parents 1a9b886 + ea95cc0 commit 6e4bdaa

File tree

26 files changed

+269
-199
lines changed

26 files changed

+269
-199
lines changed
File renamed without changes.

src/azure-changesafety/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Azure CLI Change Safety Extension
2+
Azure CLI extension for managing Change Safety `ChangeState` resources used to coordinate operational changes across Azure targets.
3+
4+
## Installation
5+
```bash
6+
az extension add --source <path-to-extension-dist> --yes
7+
# or install the latest published build
8+
az extension add --name azure-changesafety
9+
```
10+
11+
## Commands
12+
```bash
13+
az changesafety changestate create # Create a ChangeState definition for one or more targets.
14+
az changesafety changestate update # Update metadata, rollout configuration, or target definitions.
15+
az changesafety changestate delete # Delete a ChangeState resource.
16+
az changesafety changestate show # Display details for a ChangeState resource.
17+
```
18+
19+
Run `az changesafety changestate -h` to see full parameter details and examples.
20+
21+
## Examples
22+
Create a ChangeState describing a web app rollout:
23+
```bash
24+
az changesafety changestate create \
25+
-g MyResourceGroup \
26+
-n webapp-rollout-01 \
27+
--change-type AppDeployment \
28+
--rollout-type Normal \
29+
--targets "resourceId=/subscriptions/<subId>/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/myApp,operation=create" \
30+
--links name=Runbook uri=https://contoso.com/runbook
31+
```
32+
33+
Update the rollout type and add a comment:
34+
```bash
35+
az changesafety changestate update \
36+
-g MyResourceGroup \
37+
-n webapp-rollout-01 \
38+
--rollout-type Emergency \
39+
--comments "Escalated due to customer impact"
40+
```
41+
42+
Delete a ChangeState:
43+
```bash
44+
az changesafety changestate delete -g MyResourceGroup -n webapp-rollout-01 --yes
45+
```
46+
47+
## Additional Information
48+
- View command documentation: `az changesafety changestate -h`
49+
- Remove the extension when no longer needed: `az extension remove --name azure-changesafety`
File renamed without changes.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=line-too-long
9+
# pylint: disable=too-many-lines
10+
11+
from knack.help_files import helps # pylint: disable=unused-import
12+
13+
helps['changesafety'] = """
14+
type: group
15+
short-summary: Manage Change Safety resources.
16+
"""
17+
18+
helps['changesafety changestate'] = """
19+
type: group
20+
short-summary: Manage ChangeState resources that describe planned changes across targets.
21+
"""
22+
23+
helps['changesafety changestate create'] = """
24+
type: command
25+
short-summary: Create a ChangeState resource.
26+
long-summary: >
27+
Provide at least one target definition to describe which resources or operations the change
28+
will affect. Targets are expressed as comma or semicolon separated key=value pairs such as
29+
resourceId=RESOURCE_ID,operation=DELETE. The command is also available through the alias
30+
`az change-safety change-state`.
31+
parameters:
32+
- name: --targets
33+
short-summary: >
34+
One or more target definitions expressed as key=value pairs (for example
35+
resourceId=RESOURCE_ID,operation=CREATE,resourceType=Microsoft.Compute/virtualMachines).
36+
- name: --change-type
37+
short-summary: Classify the change such as AppDeployment, Config, ManualTouch, or PolicyDeployment.
38+
- name: --rollout-type
39+
short-summary: Specify the rollout urgency (Normal, Hotfix, or Emergency).
40+
- name: --stage-map
41+
short-summary: Reference an existing StageMap resource using resource-id=RESOURCE_ID and optional parameters key=value pairs.
42+
- name: --links
43+
short-summary: Add supporting links by repeating --links name=NAME uri=URL [description=TEXT].
44+
examples:
45+
- name: Create a change state for a VM rollout
46+
text: |-
47+
az changesafety changestate create -g MyResourceGroup -n deploy-001 --change-type AppDeployment --rollout-type Normal --targets resourceId=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm,operation=PUT
48+
- name: Create with staging rollout configuration
49+
text: |-
50+
az changesafety changestate create -g MyResourceGroup -n ops-change-01 --rollout-type Hotfix --targets resourceId=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/myApp,operation=POST
51+
"""
52+
53+
helps['changesafety changestate update'] = """
54+
type: command
55+
short-summary: Update an existing ChangeState resource.
56+
long-summary: >
57+
Use this command to modify descriptive metadata, rollout settings, or replace targets for an
58+
existing change. When you pass --targets, the supplied definitions overwrite the previous set.
59+
This command is also available through the alias `az change-safety change-state`.
60+
parameters:
61+
- name: --targets
62+
short-summary: >
63+
Optional target definitions to replace the existing list. Provide key=value pairs such as
64+
resourceId=RESOURCE_ID,operation=DELETE.
65+
- name: --comments
66+
short-summary: Provide notes about the latest update to the change state.
67+
- name: --anticipated-start-time
68+
short-summary: Update the expected start time in ISO 8601 format.
69+
- name: --anticipated-end-time
70+
short-summary: Update the expected completion time in ISO 8601 format.
71+
examples:
72+
- name: Adjust rollout type and add a comment
73+
text: |-
74+
az changesafety changestate update -g MyResourceGroup -n deploy-001 --rollout-type Emergency --comments "Escalated to emergency rollout"
75+
- name: Replace the target definition
76+
text: |-
77+
az changesafety changestate update -g MyResourceGroup -n deploy-001 --targets resourceId=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/servers/myServer,operation=PATCH
78+
"""
79+
80+
helps['changesafety changestate delete'] = """
81+
type: command
82+
short-summary: Delete a ChangeState resource.
83+
examples:
84+
- name: Delete a change state without confirmation
85+
text: |-
86+
az changesafety changestate delete -g MyResourceGroup -n deploy-001 --yes
87+
"""
88+
89+
helps['changesafety changestate show'] = """
90+
type: command
91+
short-summary: Show details for a ChangeState resource.
92+
examples:
93+
- name: Show a change state
94+
text: |-
95+
az changesafety changestate show -g MyResourceGroup -n deploy-001
96+
"""
File renamed without changes.

src/change-state/azext_change_state/aaz/__init__.py renamed to src/azure-changesafety/azext_change_state/aaz/__init__.py

File renamed without changes.

src/change-state/azext_change_state/aaz/latest/__init__.py renamed to src/azure-changesafety/azext_change_state/aaz/latest/__init__.py

File renamed without changes.

src/change-state/azext_change_state/aaz/latest/change_safety/__cmd_group.py renamed to src/azure-changesafety/azext_change_state/aaz/latest/change_safety/__cmd_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
@register_command_group(
15-
"change-safety",
15+
"changesafety",
1616
)
1717
class __CMDGroup(AAZCommandGroup):
1818
"""Manage Change Safety

src/change-state/azext_change_state/aaz/latest/change_safety/__init__.py renamed to src/azure-changesafety/azext_change_state/aaz/latest/change_safety/__init__.py

File renamed without changes.

src/change-state/azext_change_state/aaz/latest/change_safety/change_state/__cmd_group.py renamed to src/azure-changesafety/azext_change_state/aaz/latest/change_safety/change_state/__cmd_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
@register_command_group(
15-
"change-safety change-state",
15+
"changesafety changestate",
1616
)
1717
class __CMDGroup(AAZCommandGroup):
1818
"""Manage Change State

0 commit comments

Comments
 (0)