Skip to content

Commit aac3a03

Browse files
authored
New Powershell Module for Disconnected Operations (#28870)
1 parent 218a56b commit aac3a03

File tree

76 files changed

+8785
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+8785
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bin
2+
obj
3+
.vs
4+
generated
5+
internal
6+
exports
7+
tools
8+
test/*-TestResults.xml
9+
license.txt
10+
/*.ps1
11+
/*.psd1
12+
/*.ps1xml
13+
/*.psm1
14+
/*.snk
15+
/*.csproj
16+
/*.nuspec
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
4+
// Copyright (c) Microsoft Corporation. All rights reserved.
5+
// Licensed under the Apache License, Version 2.0 (the ""License"");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an ""AS IS"" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
15+
// is regenerated.
16+
17+
using System;
18+
using System.Reflection;
19+
using System.Runtime.CompilerServices;
20+
using System.Runtime.InteropServices;
21+
22+
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
23+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
24+
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
25+
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - DisconnectedOperationsService")]
26+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0")]
27+
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0")]
28+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
29+
[assembly: System.CLSCompliantAttribute(false)]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- region Generated -->
2+
# Az.DisconnectedOperations
3+
This directory contains the PowerShell module for the DisconnectedOperations service.
4+
5+
---
6+
## Info
7+
- Modifiable: yes
8+
- Generated: all
9+
- Committed: yes
10+
- Packaged: yes
11+
12+
---
13+
## Detail
14+
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
15+
16+
## Module Requirements
17+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
18+
19+
## Authentication
20+
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
21+
22+
## Development
23+
For information on how to develop for `Az.DisconnectedOperations`, see [how-to.md](how-to.md).
24+
<!-- endregion -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"resourceType": "disconnectedOperations/images/artifacts",
3+
"apiVersion": "2025-06-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.disconnectedoperations"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzDisconnectedOperationsArtifact",
10+
"description": "Get the resource",
11+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.disconnectedoperations/get-azdisconnectedoperationsartifact"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-ArtifactName <String>",
20+
"-ImageName <String>",
21+
"-Name <String>",
22+
"-ResourceGroupName <String>",
23+
"[-SubscriptionId <String[]>]"
24+
]
25+
}
26+
]
27+
},
28+
"examples": [
29+
{
30+
"description": "Get the resource",
31+
"parameters": [
32+
{
33+
"name": "-ArtifactName",
34+
"value": "[Path.artifactName]"
35+
},
36+
{
37+
"name": "-ImageName",
38+
"value": "[Path.imageName]"
39+
},
40+
{
41+
"name": "-Name",
42+
"value": "[Path.name]"
43+
},
44+
{
45+
"name": "-ResourceGroupName",
46+
"value": "[Path.resourceGroupName]"
47+
},
48+
{
49+
"name": "-SubscriptionId",
50+
"value": "[Path.subscriptionId]"
51+
}
52+
]
53+
}
54+
]
55+
}
56+
]
57+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"resourceType": "disconnectedOperations/images",
3+
"apiVersion": "2025-06-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.disconnectedoperations"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzDisconnectedOperationsImage",
10+
"description": "Get the resource.",
11+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.disconnectedoperations/get-azdisconnectedoperationsimage"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-ImageName <String>",
20+
"-Name <String>",
21+
"-ResourceGroupName <String>",
22+
"[-SubscriptionId <String[]>]"
23+
]
24+
}
25+
]
26+
},
27+
"examples": [
28+
{
29+
"description": "Get the resource.",
30+
"parameters": [
31+
{
32+
"name": "-ImageName",
33+
"value": "[Path.imageName]"
34+
},
35+
{
36+
"name": "-Name",
37+
"value": "[Path.name]"
38+
},
39+
{
40+
"name": "-ResourceGroupName",
41+
"value": "[Path.resourceGroupName]"
42+
},
43+
{
44+
"name": "-SubscriptionId",
45+
"value": "[Path.subscriptionId]"
46+
}
47+
]
48+
}
49+
]
50+
}
51+
]
52+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"resourceType": "disconnectedOperations",
3+
"apiVersion": "2025-06-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.disconnectedoperations"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzDisconnectedOperationsDisconnectedOperation",
10+
"description": "Get a DisconnectedOperation",
11+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.disconnectedoperations/get-azdisconnectedoperationsdisconnectedoperation"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-Name <String>",
20+
"-ResourceGroupName <String>",
21+
"[-SubscriptionId <String[]>]"
22+
]
23+
}
24+
]
25+
},
26+
"examples": [
27+
{
28+
"description": "Get a DisconnectedOperation",
29+
"parameters": [
30+
{
31+
"name": "-Name",
32+
"value": "[Path.name]"
33+
},
34+
{
35+
"name": "-ResourceGroupName",
36+
"value": "[Path.resourceGroupName]"
37+
},
38+
{
39+
"name": "-SubscriptionId",
40+
"value": "[Path.subscriptionId]"
41+
}
42+
]
43+
}
44+
]
45+
},
46+
{
47+
"name": "Remove-AzDisconnectedOperationsDisconnectedOperation",
48+
"description": "Delete a DisconnectedOperation",
49+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}",
50+
"help": {
51+
"learnMore": {
52+
"url": "https://learn.microsoft.com/powershell/module/az.disconnectedoperations/remove-azdisconnectedoperationsdisconnectedoperation"
53+
},
54+
"parameterSets": [
55+
{
56+
"parameters": [
57+
"-Name <String>",
58+
"-ResourceGroupName <String>",
59+
"[-SubscriptionId <String>]"
60+
]
61+
}
62+
]
63+
},
64+
"examples": [
65+
{
66+
"description": "Delete a DisconnectedOperation",
67+
"parameters": [
68+
{
69+
"name": "-Name",
70+
"value": "[Path.name]"
71+
},
72+
{
73+
"name": "-ResourceGroupName",
74+
"value": "[Path.resourceGroupName]"
75+
},
76+
{
77+
"name": "-SubscriptionId",
78+
"value": "[Path.subscriptionId]"
79+
}
80+
]
81+
}
82+
]
83+
}
84+
]
85+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# region Generated
2+
# Load the private module dll
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.DisconnectedOperations.private.dll')
4+
5+
# Load the internal module
6+
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.DisconnectedOperations.internal.psm1'
7+
if(Test-Path $internalModulePath) {
8+
$null = Import-Module -Name $internalModulePath
9+
}
10+
11+
# Export nothing to clear implicit exports
12+
Export-ModuleMember
13+
14+
# Export script cmdlets
15+
Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
16+
Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias)
17+
# endregion
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Custom
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.DisconnectedOperations` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.DisconnectedOperations.custom.psm1`. This file should not be modified.
3+
4+
## Info
5+
- Modifiable: yes
6+
- Generated: partial
7+
- Committed: yes
8+
- Packaged: yes
9+
10+
## Details
11+
For `Az.DisconnectedOperations` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*.
12+
13+
For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.DisconnectedOperations.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder.
14+
15+
For script cmdlets, these are loaded via the `Az.DisconnectedOperations.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
16+
17+
## Purpose
18+
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.
19+
20+
## Usage
21+
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
22+
- Break
23+
- DefaultProfile
24+
- HttpPipelineAppend
25+
- HttpPipelinePrepend
26+
- Proxy
27+
- ProxyCredential
28+
- ProxyUseDefaultCredentials
29+
30+
These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.DisconnectedOperations`. For C#, follow the usage seen in the `ProcessRecordAsync` method.
31+
32+
### Attributes
33+
For processing the cmdlets, we've created some additional attributes:
34+
- `Microsoft.Azure.PowerShell.Cmdlets.DisconnectedOperations.DescriptionAttribute`
35+
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
36+
- `Microsoft.Azure.PowerShell.Cmdlets.DisconnectedOperations.DoNotExportAttribute`
37+
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.DisconnectedOperations`.
38+
- `Microsoft.Azure.PowerShell.Cmdlets.DisconnectedOperations.InternalExportAttribute`
39+
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.DisconnectedOperations`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
40+
- `Microsoft.Azure.PowerShell.Cmdlets.DisconnectedOperations.ProfileAttribute`
41+
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
Module Name: Az.DisconnectedOperations
3+
Module Guid: 9d4b8f10-3daa-4f24-954d-c8dcfe2a2ccd
4+
Download Help Link: https://learn.microsoft.com/powershell/module/az.disconnectedoperations
5+
Help Version: 1.0.0.0
6+
Locale: en-US
7+
---
8+
9+
# Az.DisconnectedOperations Module
10+
## Description
11+
Microsoft Azure PowerShell: DisconnectedOperations cmdlets
12+
13+
## Az.DisconnectedOperations Cmdlets
14+
### [Get-AzDisconnectedOperationsArtifact](Get-AzDisconnectedOperationsArtifact.md)
15+
Get the resource
16+
17+
### [Get-AzDisconnectedOperationsArtifactDownloadUri](Get-AzDisconnectedOperationsArtifactDownloadUri.md)
18+
Get artifact download link.
19+
20+
### [Get-AzDisconnectedOperationsDisconnectedOperation](Get-AzDisconnectedOperationsDisconnectedOperation.md)
21+
Get a DisconnectedOperation
22+
23+
### [Get-AzDisconnectedOperationsDisconnectedOperationDeploymentManifest](Get-AzDisconnectedOperationsDisconnectedOperationDeploymentManifest.md)
24+
Get deployment manifest.
25+
26+
### [Get-AzDisconnectedOperationsImage](Get-AzDisconnectedOperationsImage.md)
27+
Get the resource.
28+
29+
### [Get-AzDisconnectedOperationsImageDownloadUri](Get-AzDisconnectedOperationsImageDownloadUri.md)
30+
Get the URI to download the image.
31+
32+
### [New-AzDisconnectedOperationsDisconnectedOperation](New-AzDisconnectedOperationsDisconnectedOperation.md)
33+
Create a DisconnectedOperation
34+
35+
### [Remove-AzDisconnectedOperationsDisconnectedOperation](Remove-AzDisconnectedOperationsDisconnectedOperation.md)
36+
Delete a DisconnectedOperation
37+
38+
### [Update-AzDisconnectedOperationsDisconnectedOperation](Update-AzDisconnectedOperationsDisconnectedOperation.md)
39+
Update a DisconnectedOperation
40+

0 commit comments

Comments
 (0)