Skip to content

Commit

Permalink
Microsoft.Chaos - a few follow-up fixes after TypeSpec migration (#32119
Browse files Browse the repository at this point in the history
)

* removed provisioning state from a few models

* fixed based on linting

* built from main instead of client

* feat: add 2025-01-01 API version with updated capability type properties

* chore: fix properties

* added back missing provisioningState in preview version

* changed inline docs

* fixing documentation

* feat: add required role definition ids to capability type

* Create sdk-suppressions.yaml

---------

Co-authored-by: renzopretto <[email protected]>
Co-authored-by: kazrael2119 <[email protected]>
  • Loading branch information
3 people authored Feb 3, 2025
1 parent cc5e8fa commit 2756f8f
Show file tree
Hide file tree
Showing 60 changed files with 5,332 additions and 2 deletions.
3 changes: 3 additions & 0 deletions specification/chaos/Chaos.Management/capability.models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ using TypeSpec.Http;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using TypeSpec.OpenAPI;
using TypeSpec.Versioning;

namespace Microsoft.Chaos;

Expand All @@ -31,6 +32,7 @@ alias CapabilityParentResourceParameters = BaseParameters<Capability> &
/**
* Model that represents the Capability properties model.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Unused property, avoids breaking changes in SDK."
model CapabilityProperties {
/**
* String of the Publisher that this Capability extends.
Expand Down Expand Up @@ -67,6 +69,7 @@ model CapabilityProperties {
/**
* Resource provisioning state. Not currently in use because resource is created synchronously.
*/
@removed(Microsoft.Chaos.Versions.v2025_01_01)
@visibility("read")
provisioningState?: ProvisioningState;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using TypeSpec.Http;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using TypeSpec.OpenAPI;
using TypeSpec.Versioning;

namespace Microsoft.Chaos;

Expand Down Expand Up @@ -86,6 +87,13 @@ model CapabilityTypeProperties {
@visibility("read")
azureRbacDataActions?: string[];

/**
* Required Azure Role Definition Ids to execute capability type.
*/
@visibility("read")
@added(Microsoft.Chaos.Versions.v2025_01_01)
requiredAzureRoleDefinitionIds?: string[];

/**
* Runtime properties of this Capability Type.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"parameters": {
"api-version": "2025-01-01",
"resource": {
"properties": {}
},
"capabilityName": "Shutdown-1.0",
"parentProviderNamespace": "Microsoft.Compute",
"parentResourceName": "exampleVM",
"parentResourceType": "virtualMachines",
"resourceGroupName": "exampleRG",
"subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291",
"targetName": "Microsoft-VirtualMachine"
},
"responses": {
"200": {
"body": {
"name": "Shutdown-1.0",
"type": "Microsoft.Chaos/targets/capabilities",
"id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0",
"properties": {
"description": "Shutdown an Azure Virtual Machine for a defined period of time.",
"parametersSchema": "https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json",
"publisher": "Microsoft",
"targetType": "VirtualMachine",
"urn": "urn:csci:microsoft:virtualMachine:shutdown/1.0"
},
"systemData": {
"createdAt": "2020-05-14T05:08:38.4662189Z",
"lastModifiedAt": "2020-05-14T05:08:38.4662189Z"
}
}
},
"201": {
"body": {
"name": "Shutdown-1.0",
"type": "Microsoft.Chaos/targets/capabilities",
"id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0",
"properties": {
"description": "Shutdown an Azure Virtual Machine for a defined period of time.",
"parametersSchema": "https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json",
"publisher": "Microsoft",
"targetType": "VirtualMachine",
"urn": "urn:csci:microsoft:virtualMachine:shutdown/1.0"
},
"systemData": {
"createdAt": "2020-05-14T05:08:38.4662189Z",
"lastModifiedAt": "2020-05-14T05:08:38.4662189Z"
}
}
}
},
"operationId": "Capabilities_CreateOrUpdate",
"title": "Create/update a Capability that extends a virtual machine Target resource."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parameters": {
"api-version": "2025-01-01",
"capabilityName": "Shutdown-1.0",
"parentProviderNamespace": "Microsoft.Compute",
"parentResourceName": "exampleVM",
"parentResourceType": "virtualMachines",
"resourceGroupName": "exampleRG",
"subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291",
"targetName": "Microsoft-VirtualMachine"
},
"responses": {
"200": {},
"204": {}
},
"operationId": "Capabilities_Delete",
"title": "Delete a Capability that extends a virtual machine Target resource."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parameters": {
"api-version": "2025-01-01",
"capabilityName": "Shutdown-1.0",
"parentProviderNamespace": "Microsoft.Compute",
"parentResourceName": "exampleVM",
"parentResourceType": "virtualMachines",
"resourceGroupName": "exampleRG",
"subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291",
"targetName": "Microsoft-VirtualMachine"
},
"responses": {
"200": {
"body": {
"name": "Shutdown-1.0",
"type": "Microsoft.Chaos/targets/capabilities",
"id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0",
"properties": {
"description": "Shutdown an Azure Virtual Machine for a defined period of time.",
"parametersSchema": "https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json",
"publisher": "Microsoft",
"targetType": "VirtualMachine",
"urn": "urn:csci:microsoft:virtualMachine:shutdown/1.0"
},
"systemData": {
"createdAt": "2020-05-14T05:08:38.4662189Z",
"lastModifiedAt": "2020-05-14T05:08:38.4662189Z"
}
}
}
},
"operationId": "Capabilities_Get",
"title": "Get a Capability that extends a virtual machine Target resource."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"parameters": {
"api-version": "2025-01-01",
"parentProviderNamespace": "Microsoft.Compute",
"parentResourceName": "exampleVM",
"parentResourceType": "virtualMachines",
"resourceGroupName": "exampleRG",
"subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291",
"targetName": "Microsoft-VirtualMachine"
},
"responses": {
"200": {
"body": {
"nextLink": "https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities?continuationToken=&api-version=2024-11-01-preview",
"value": [
{
"name": "Shutdown-1.0",
"type": "Microsoft.Chaos/targets/capabilities",
"id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0",
"properties": {
"description": "Shutdown an Azure Virtual Machine for a defined period of time.",
"parametersSchema": "https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json",
"publisher": "Microsoft",
"targetType": "VirtualMachine",
"urn": "urn:csci:microsoft:virtualMachine:shutdown/1.0"
},
"systemData": {
"createdAt": "2020-05-14T05:08:38.4662189Z",
"lastModifiedAt": "2020-05-14T05:08:38.4662189Z"
}
}
]
}
}
},
"operationId": "Capabilities_List",
"title": "List all Capabilities that extend a virtual machine Target resource."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"parameters": {
"api-version": "2025-01-01",
"capabilityTypeName": "Shutdown-1.0",
"location": "westus2",
"subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291",
"targetTypeName": "Microsoft-VirtualMachine"
},
"responses": {
"200": {
"body": {
"name": "Shutdown-1.0",
"type": "Microsoft.Chaos/locations/targetTypes/capabilityTypes",
"id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0",
"properties": {
"description": "Shutdown an Azure Virtual Machine for a defined period of time.",
"displayName": "Shutdown VM",
"kind": "fault",
"parametersSchema": "https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json",
"publisher": "Microsoft",
"runtimeProperties": {
"kind": "continuous"
},
"targetType": "VirtualMachine",
"urn": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
"azureRbacActions": [
"Microsoft.Compute/virtualMachines/poweroff/action",
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/instanceView/read",
"Microsoft.Compute/virtualMachines/read",
"Microsoft.Compute/locations/operations/read"
],
"requiredAzureRoleDefinitionIds": [
"acdd72a7-3385-48ef-bd42-f606fba81ae0"
]
}
}
}
},
"operationId": "CapabilityTypes_Get",
"title": "Get a Capability Type for a virtual machine Target resource on westus2 location."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"parameters": {
"api-version": "2025-01-01",
"location": "westus2",
"subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291",
"targetTypeName": "Microsoft-VirtualMachine"
},
"responses": {
"200": {
"body": {
"nextLink": "https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes?continuationToken=&api-version=2024-11-01-preview",
"value": [
{
"name": "Shutdown-1.0",
"type": "Microsoft.Chaos/locations/targetTypes/capabilityTypes",
"id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0",
"properties": {
"description": "Shutdown an Azure Virtual Machine for a defined period of time.",
"displayName": "Shutdown VM",
"kind": "fault",
"parametersSchema": "https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json",
"publisher": "Microsoft",
"runtimeProperties": {
"kind": "continuous"
},
"targetType": "VirtualMachine",
"urn": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
"azureRbacActions": [
"Microsoft.Compute/virtualMachines/poweroff/action",
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/instanceView/read",
"Microsoft.Compute/virtualMachines/read",
"Microsoft.Compute/locations/operations/read"
],
"requiredAzureRoleDefinitionIds": [
"acdd72a7-3385-48ef-bd42-f606fba81ae0"
]
}
}
]
}
}
},
"operationId": "CapabilityTypes_List",
"title": "List all Capability Types for a virtual machine Target resource on westus2 location."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parameters": {
"api-version": "2025-01-01",
"experimentName": "exampleExperiment",
"resourceGroupName": "exampleRG",
"subscriptionId": "6b052e15-03d3-4f17-b2e1-be7f07588291"
},
"responses": {
"202": {
"headers": {
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/myResourceGroup/providers/Microsoft.Chaos/locations/eastus/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2024-11-01-preview",
"Location": "https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/myResourceGroup/providers/Microsoft.Chaos/locations/eastus/operationResults/00000000-0000-0000-0000-000000000000?api-version=2024-11-01-preview"
}
}
},
"operationId": "Experiments_Cancel",
"title": "Cancel a running Experiment."
}
Loading

0 comments on commit 2756f8f

Please sign in to comment.