Skip to content

[Chaos] Create new module: Az.Chaos #24444

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
merged 7 commits into from
May 7, 2024
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
1 change: 1 addition & 0 deletions src/Chaos/Chaos.Autorest/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
16 changes: 16 additions & 0 deletions src/Chaos/Chaos.Autorest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bin
obj
.vs
generated
internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
/*.psm1
/*.snk
/*.csproj
/*.nuspec
23 changes: 23 additions & 0 deletions src/Chaos/Chaos.Autorest/Az.Chaos.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@{
GUID = 'ca01a43f-b9c7-4e71-a41d-a185e2355c98'
RootModule = './Az.Chaos.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: Chaos cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Chaos.private.dll'
FormatsToProcess = './Az.Chaos.format.ps1xml'
FunctionsToExport = 'Get-AzChaosCapability', 'Get-AzChaosCapabilityType', 'Get-AzChaosExecutionExperimentDetail', 'Get-AzChaosExperiment', 'Get-AzChaosExperimentExecution', 'Get-AzChaosTarget', 'Get-AzChaosTargetType', 'New-AzChaosActionObject', 'New-AzChaosBranchObject', 'New-AzChaosCapability', 'New-AzChaosExperiment', 'New-AzChaosSelectorObject', 'New-AzChaosStepObject', 'New-AzChaosTarget', 'Remove-AzChaosCapability', 'Remove-AzChaosExperiment', 'Remove-AzChaosTarget', 'Start-AzChaosExperiment', 'Stop-AzChaosExperiment', 'Update-AzChaosCapability', 'Update-AzChaosExperiment', 'Update-AzChaosTarget'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Chaos'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}
203 changes: 203 additions & 0 deletions src/Chaos/Chaos.Autorest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<!-- region Generated -->
# Az.Chaos
This directory contains the PowerShell module for the Chaos service.

---
## Info
- Modifiable: yes
- Generated: all
- Committed: yes
- Packaged: yes

---
## Detail
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

## Module Requirements
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.

## Development
For information on how to develop for `Az.Chaos`, see [how-to.md](how-to.md).
<!-- endregion -->

### AutoRest Configuration
> see https://aka.ms/autorest

``` yaml
commit: 907b79c0a6a660826e54dc1f16ea14b831b201d2
require:
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
- $(repo)/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/capabilities.json
- $(repo)/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/capabilityTypes.json
- $(repo)/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/experiments.json
- $(repo)/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/operationStatuses.json
- $(repo)/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/operations.json
- $(repo)/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/targetTypes.json
- $(repo)/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/targets.json

title: Chaos
module-version: 0.1.0
subject-prefix: $(service-name)

identity-correction-for-post: true

directive:
- from: swagger-document
where: $.definitions.TrackedResource.properties.location
transform: >-
return {
"type": "string",
"x-ms-mutability": [
"read",
"create",
"update"
],
"description": "The geo-location where the resource lives"
}

- from: swagger-document
where: $.definitions.target
transform: >-
return {
"type": "object",
"description": "Model that represents a Target resource.",
"allOf": [
{
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/907b79c0a6a660826e54dc1f16ea14b831b201d2/specification/common-types/resource-management/v2/types.json#/definitions/Resource"
}
],
"properties": {
"systemData": {
"description": "The system metadata of the target resource.",
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/907b79c0a6a660826e54dc1f16ea14b831b201d2/specification/common-types/resource-management/v2/types.json#/definitions/systemData",
"readOnly": true
},
"location": {
"type": "string",
"description": "Location of the target resource."
},
"properties": {
"description": "The properties of the target resource.",
"x-ms-client-flatten": true,
"$ref": "#/definitions/targetProperties"
}
}
}

- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"].delete.responses
transform: >-
return {
"200": {
"description": "OK"
},
"202": {
"description": "Asynchronous delete operation."
},
"default": {
"description": "Error response returned if request was unsuccessful.",
"schema": {
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/907b79c0a6a660826e54dc1f16ea14b831b201d2/specification/common-types/resource-management/v5/types.json#/definitions/ErrorResponse"
}
}
}

- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"].patch.responses
transform: >-
return {
"200": {
"description": "Long running replace experiment operation.",
"schema": {
"$ref": "./types/experiments.json#/definitions/experiment"
}
},
"202": {
"description": "Long running update operation.",
"schema": {
"$ref": "./types/experiments.json#/definitions/experiment"
}
},
"default": {
"description": "Error response returned if request was unsuccessful.",
"schema": {
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/907b79c0a6a660826e54dc1f16ea14b831b201d2/specification/common-types/resource-management/v5/types.json#/definitions/ErrorResponse"
}
}
}

- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start"].post.responses
transform: >-
return {
"200": {
"description": "Ok.",
"schema": {
"$ref": "./types/experiments.json#/definitions/experiment"
}
},
"202": {
"description": "Long running start experiment operation."
},
"default": {
"description": "Error response returned if request was unsuccessful.",
"schema": {
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/907b79c0a6a660826e54dc1f16ea14b831b201d2/specification/common-types/resource-management/v5/types.json#/definitions/ErrorResponse"
}
}
}

- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel"].post.responses
transform: >-
return {
"200": {
"description": "Ok.",
"schema": {
"$ref": "./types/experiments.json#/definitions/experiment"
}
},
"202": {
"description": "Long running start experiment operation."
},
"default": {
"description": "Error response returned if request was unsuccessful.",
"schema": {
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/907b79c0a6a660826e54dc1f16ea14b831b201d2/specification/common-types/resource-management/v5/types.json#/definitions/ErrorResponse"
}
}
}

- where:
verb: New
subject: Experiment
variant: ^CreateViaIdentityExpanded$|^CreateExpanded$
remove: true

- where:
variant: ^(Create|Update).*(?<!Expanded|JsonFilePath|JsonString)$
remove: true

- where:
verb: Set
remove: true

- where:
subject: OperationStatuses
remove: true

- where:
verb: Invoke
set:
verb: Get

- model-cmdlet:
- model-name: Selector
- model-name: Step
- model-name: Branch
- model-name: Action
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"resourceType": "experiments/executions",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.chaos"
},
"commands": [
{
"name": "Get-AzChaosExecutionExperimentDetail",
"description": "Execution details of an experiment resource.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.chaos/get-azchaosexecutionexperimentdetail"
},
"parameterSets": [
{
"parameters": [
"-ExecutionId <String>",
"-ExperimentName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
}
]
},
"examples": [
{
"description": "Execution details of an experiment resource.",
"parameters": [
{
"name": "-ExecutionId",
"value": "[Path.executionId]"
},
{
"name": "-ExperimentName",
"value": "[Path.experimentName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
},
{
"name": "Get-AzChaosExperimentExecution",
"description": "Get an execution of an Experiment resource.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.chaos/get-azchaosexperimentexecution"
},
"parameterSets": [
{
"parameters": [
"-ExecutionId <String>",
"-ExperimentName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
}
]
},
"examples": [
{
"description": "Get an execution of an Experiment resource.",
"parameters": [
{
"name": "-ExecutionId",
"value": "[Path.executionId]"
},
{
"name": "-ExperimentName",
"value": "[Path.experimentName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
}
]
}
Loading