Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
}
}
}
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"
}
}
}
}
}
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"
}
}
}
}
}
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"
}
}
}
}
}
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"
}
}
}
}
}
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"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import "@typespec/http";
Comment thread
RenzoPrettoMS marked this conversation as resolved.
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;
}
Loading
Loading