Repository navigation
[Chaos] Propose scoped conditional PUT contract for 2026-11-01 #47577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Frank Li (franklixuefei)
merged 3 commits into
Azure:juliagao-microsoft-chaos-2026-11-ga-promotion
from
franklixuefei:xuefl-microsoft-v2-precondition-spec
Oct 23, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...oft.Chaos/Chaos/examples/2026-11-01/ScenarioConfigurations_CreateOrUpdate_CreateOnly.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "title": "Create a scenario configuration only when absent, or return 412 when it already exists", | ||
| "operationId": "ScenarioConfigurations_CreateOrUpdate", | ||
| "parameters": { | ||
| "api-version": "2026-11-01", | ||
| "subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291", | ||
| "resourceGroupName": "exampleRG", | ||
| "workspaceName": "exampleWorkspace", | ||
| "scenarioName": "exampleScenario", | ||
| "scenarioConfigurationName": "exampleConfiguration", | ||
| "If-None-Match": "*", | ||
| "resource": { | ||
| "properties": { | ||
| "scenarioId": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario" | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "201": { | ||
| "headers": { | ||
| "Azure-AsyncOperation": "https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/operationStatuses/4bdadd97-207c-4de8-9bba-08339ae099c7?api-version=2026-11-01", | ||
| "Retry-After": 10 | ||
| }, | ||
| "body": { | ||
| "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario/configurations/exampleConfiguration", | ||
| "name": "exampleConfiguration", | ||
| "type": "Microsoft.Chaos/workspaces/scenarios/configurations", | ||
| "properties": { | ||
| "scenarioId": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario", | ||
| "provisioningState": "Creating" | ||
| } | ||
| } | ||
| }, | ||
| "default": { | ||
| "body": { | ||
| "error": { | ||
| "code": "PreconditionFailed", | ||
| "message": "The scenario configuration already exists. The create-only precondition failed.", | ||
| "target": "If-None-Match" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
...oft.Chaos/Chaos/examples/2026-11-01/ScenarioConfigurations_CreateOrUpdate_UpdateOnly.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| { | ||
| "title": "Update a scenario configuration only when present, or return 412 when it does not exist", | ||
| "operationId": "ScenarioConfigurations_CreateOrUpdate", | ||
| "parameters": { | ||
| "api-version": "2026-11-01", | ||
| "subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291", | ||
| "resourceGroupName": "exampleRG", | ||
| "workspaceName": "exampleWorkspace", | ||
| "scenarioName": "exampleScenario", | ||
| "scenarioConfigurationName": "exampleConfiguration", | ||
| "If-Match": "*", | ||
| "resource": { | ||
| "properties": { | ||
| "scenarioId": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario" | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario/configurations/exampleConfiguration", | ||
| "name": "exampleConfiguration", | ||
| "type": "Microsoft.Chaos/workspaces/scenarios/configurations", | ||
| "properties": { | ||
| "scenarioId": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario", | ||
| "provisioningState": "Succeeded" | ||
| } | ||
| } | ||
| }, | ||
| "default": { | ||
| "body": { | ||
| "error": { | ||
| "code": "PreconditionFailed", | ||
| "message": "The scenario configuration does not exist. The update-only precondition failed.", | ||
| "target": "If-Match" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
74 changes: 74 additions & 0 deletions
74
...anager/Microsoft.Chaos/Chaos/examples/2026-11-01/Scenarios_CreateOrUpdate_CreateOnly.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| { | ||
| "title": "Create a scenario only when absent, or return 412 when it already exists", | ||
| "operationId": "Scenarios_CreateOrUpdate", | ||
| "parameters": { | ||
| "api-version": "2026-11-01", | ||
| "subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291", | ||
| "resourceGroupName": "exampleRG", | ||
| "workspaceName": "exampleWorkspace", | ||
| "scenarioName": "exampleScenario", | ||
| "If-None-Match": "*", | ||
| "resource": { | ||
| "properties": { | ||
| "parameters": [], | ||
| "actions": [ | ||
| { | ||
| "name": "restart", | ||
| "actionId": "microsoft-compute-shutdown/2.0", | ||
| "duration": "PT5M", | ||
| "selectors": [ | ||
| { | ||
| "name": "logicalZone", | ||
| "value": "1" | ||
| }, | ||
| { | ||
| "name": "location", | ||
| "value": "eastus" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "201": { | ||
| "body": { | ||
| "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario", | ||
| "name": "exampleScenario", | ||
| "type": "Microsoft.Chaos/workspaces/scenarios", | ||
| "properties": { | ||
| "version": "1.0", | ||
| "parameters": [], | ||
| "actions": [ | ||
| { | ||
| "name": "restart", | ||
| "actionId": "microsoft-compute-shutdown/2.0", | ||
| "duration": "PT5M", | ||
| "selectors": [ | ||
| { | ||
| "name": "logicalZone", | ||
| "value": "1" | ||
| }, | ||
| { | ||
| "name": "location", | ||
| "value": "eastus" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "provisioningState": "Succeeded" | ||
| } | ||
| } | ||
| }, | ||
| "default": { | ||
| "body": { | ||
| "error": { | ||
| "code": "PreconditionFailed", | ||
| "message": "The scenario already exists. The create-only precondition failed.", | ||
| "target": "If-None-Match" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
74 changes: 74 additions & 0 deletions
74
...anager/Microsoft.Chaos/Chaos/examples/2026-11-01/Scenarios_CreateOrUpdate_UpdateOnly.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| { | ||
| "title": "Update a scenario only when present, or return 412 when it does not exist", | ||
| "operationId": "Scenarios_CreateOrUpdate", | ||
| "parameters": { | ||
| "api-version": "2026-11-01", | ||
| "subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291", | ||
| "resourceGroupName": "exampleRG", | ||
| "workspaceName": "exampleWorkspace", | ||
| "scenarioName": "exampleScenario", | ||
| "If-Match": "*", | ||
| "resource": { | ||
| "properties": { | ||
| "parameters": [], | ||
| "actions": [ | ||
| { | ||
| "name": "restart", | ||
| "actionId": "microsoft-compute-shutdown/2.0", | ||
| "duration": "PT5M", | ||
| "selectors": [ | ||
| { | ||
| "name": "logicalZone", | ||
| "value": "1" | ||
| }, | ||
| { | ||
| "name": "location", | ||
| "value": "eastus" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/exampleScenario", | ||
| "name": "exampleScenario", | ||
| "type": "Microsoft.Chaos/workspaces/scenarios", | ||
| "properties": { | ||
| "version": "1.0", | ||
| "parameters": [], | ||
| "actions": [ | ||
| { | ||
| "name": "restart", | ||
| "actionId": "microsoft-compute-shutdown/2.0", | ||
| "duration": "PT5M", | ||
| "selectors": [ | ||
| { | ||
| "name": "logicalZone", | ||
| "value": "1" | ||
| }, | ||
| { | ||
| "name": "location", | ||
| "value": "eastus" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "provisioningState": "Succeeded" | ||
| } | ||
| } | ||
| }, | ||
| "default": { | ||
| "body": { | ||
| "error": { | ||
| "code": "PreconditionFailed", | ||
| "message": "The scenario does not exist. The update-only precondition failed.", | ||
| "target": "If-Match" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
48 changes: 48 additions & 0 deletions
48
...nager/Microsoft.Chaos/Chaos/examples/2026-11-01/Workspaces_CreateOrUpdate_CreateOnly.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| { | ||
| "title": "Create a workspace only when absent, or return 412 when it already exists", | ||
| "operationId": "Workspaces_CreateOrUpdate", | ||
| "parameters": { | ||
| "api-version": "2026-11-01", | ||
| "subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291", | ||
| "resourceGroupName": "exampleRG", | ||
| "workspaceName": "exampleWorkspace", | ||
| "If-None-Match": "*", | ||
| "resource": { | ||
| "location": "westus2", | ||
| "properties": { | ||
| "scopes": [ | ||
| "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG" | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "201": { | ||
| "headers": { | ||
| "Azure-AsyncOperation": "https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/operationStatuses/4bdadd97-207c-4de8-9bba-08339ae099c7?api-version=2026-11-01", | ||
| "Retry-After": 10 | ||
| }, | ||
| "body": { | ||
| "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace", | ||
| "name": "exampleWorkspace", | ||
| "type": "Microsoft.Chaos/workspaces", | ||
| "location": "westus2", | ||
| "properties": { | ||
| "scopes": [ | ||
| "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG" | ||
| ], | ||
| "provisioningState": "Creating" | ||
| } | ||
| } | ||
| }, | ||
| "default": { | ||
| "body": { | ||
| "error": { | ||
| "code": "PreconditionFailed", | ||
| "message": "The workspace already exists. The create-only precondition failed.", | ||
| "target": "If-None-Match" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
...nager/Microsoft.Chaos/Chaos/examples/2026-11-01/Workspaces_CreateOrUpdate_UpdateOnly.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "title": "Update a workspace only when present, or return 412 when it does not exist", | ||
| "operationId": "Workspaces_CreateOrUpdate", | ||
| "parameters": { | ||
| "api-version": "2026-11-01", | ||
| "subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291", | ||
| "resourceGroupName": "exampleRG", | ||
| "workspaceName": "exampleWorkspace", | ||
| "If-Match": "*", | ||
| "resource": { | ||
| "location": "westus2", | ||
| "properties": { | ||
| "scopes": [ | ||
| "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG" | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace", | ||
| "name": "exampleWorkspace", | ||
| "type": "Microsoft.Chaos/workspaces", | ||
| "location": "westus2", | ||
| "properties": { | ||
| "scopes": [ | ||
| "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG" | ||
| ], | ||
| "provisioningState": "Succeeded" | ||
| } | ||
| } | ||
| }, | ||
| "default": { | ||
| "body": { | ||
| "error": { | ||
| "code": "PreconditionFailed", | ||
| "message": "The workspace does not exist. The update-only precondition failed.", | ||
| "target": "If-Match" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
specification/chaos/resource-manager/Microsoft.Chaos/Chaos/put-preconditions.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import "@typespec/http"; | ||
| import "@typespec/versioning"; | ||
|
|
||
| using TypeSpec.Http; | ||
| using TypeSpec.Versioning; | ||
|
|
||
| namespace Microsoft.Chaos; | ||
|
|
||
| /** Optional conditions for creating or updating a workspace, scenario, or scenario configuration. */ | ||
| model PutPreconditionHeaders { | ||
| /** | ||
| * Use '*' to create the resource only if it does not exist. If the resource exists, the request fails with HTTP 412 and error code PreconditionFailed in the standard Azure error body. A failed condition starts no resource change or asynchronous operation. Omit both condition headers for an unconditional create or update. Other effective conditions must be honored if supported or rejected with 412 if they cannot be verified; they must not be silently ignored. This contract does not introduce entity-tag matching. | ||
| */ | ||
| @added(Versions.v2026_11_01) | ||
| @header("If-None-Match") | ||
| ifNoneMatch?: string; | ||
|
|
||
| /** | ||
| * Use '*' to update the resource only if it exists. If the resource does not exist, the request fails with HTTP 412 and error code PreconditionFailed in the standard Azure error body. A failed condition starts no resource change or asynchronous operation. Omit both condition headers for an unconditional create or update. Other effective conditions must be honored if supported or rejected with 412 if they cannot be verified; they must not be silently ignored. This contract does not introduce entity-tag matching. | ||
| */ | ||
| @added(Versions.v2026_11_01) | ||
| @header("If-Match") | ||
| ifMatch?: string; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.