-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New powershell module for 'servicegroups' #29282
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
Open
meghanagupta95
wants to merge
10
commits into
Azure:main
Choose a base branch
from
meghanagupta95:meghanag/servicegroups
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0c5ee0d
New powershell module - initial changes
meghanagupta95 367d4f6
Merge branch 'main' into meghanag/servicegroups
meghanagupta95 64d9fb1
Update mapping rule json
meghanagupta95 f56dab8
Check in generate-info file
meghanagupta95 b7493b6
Update tests for servicegroups
meghanagupta95 f86dcbf
Update failing tests
meghanagupta95 68c1f5b
Merge branch 'main' into meghanag/servicegroups
meghanagupta95 b124b0e
Remove UpdateViaIdentity AND UpdateViaIdentityExpanded variants
meghanagupta95 9ae7a26
Update some tests
meghanagupta95 c2d293b
Remove servicegroups from generated folder
meghanagupta95 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
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 @@ | ||
| * text=auto |
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,16 @@ | ||
| bin | ||
| obj | ||
| .vs | ||
| generated | ||
| internal | ||
| exports | ||
| tools | ||
| test/*-TestResults.xml | ||
| license.txt | ||
| /*.ps1 | ||
| /*.psd1 | ||
| /*.ps1xml | ||
| /*.psm1 | ||
| /*.snk | ||
| /*.csproj | ||
| /*.nuspec |
26 changes: 26 additions & 0 deletions
26
src/ServiceGroups/ServiceGroups.Autorest/Properties/AssemblyInfo.cs
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,26 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0 (the ""License""); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an ""AS IS"" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code | ||
| // is regenerated. | ||
|
|
||
| using System; | ||
| using System.Reflection; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] | ||
| [assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] | ||
| [assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] | ||
| [assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - ServiceGroups")] | ||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0")] | ||
| [assembly: System.Reflection.AssemblyVersionAttribute("0.1.0")] | ||
| [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] | ||
| [assembly: System.CLSCompliantAttribute(false)] |
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,59 @@ | ||||||
| <!-- region Generated --> | ||||||
| # Az.ServiceGroups | ||||||
| This directory contains the PowerShell module for the ServiceGroups 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 | ||||||
|
||||||
| - [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater | |
| - [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 5.3.3 |
65 changes: 65 additions & 0 deletions
65
src/ServiceGroups/ServiceGroups.Autorest/UX/Microsoft.Management/serviceGroups.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,65 @@ | ||
| { | ||
| "resourceType": "serviceGroups", | ||
| "apiVersion": "2024-02-01-preview", | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.servicegroups" | ||
| }, | ||
| "commands": [ | ||
| { | ||
| "name": "Get-AzServiceGroup", | ||
| "description": "Get the details of the serviceGroup", | ||
| "path": "/providers/Microsoft.Management/serviceGroups/{serviceGroupName}", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.servicegroups/get-azservicegroup" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-Name <String>" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Get the details of the serviceGroup", | ||
| "parameters": [ | ||
| { | ||
| "name": "-Name", | ||
| "value": "[Path.serviceGroupName]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "Remove-AzServiceGroup", | ||
| "description": "Delete a ServiceGroup", | ||
| "path": "/providers/Microsoft.Management/serviceGroups/{serviceGroupName}", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.servicegroups/remove-azservicegroup" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-Name <String>" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Delete a ServiceGroup", | ||
| "parameters": [ | ||
| { | ||
| "name": "-Name", | ||
| "value": "[Path.serviceGroupName]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
17 changes: 17 additions & 0 deletions
17
src/ServiceGroups/ServiceGroups.Autorest/custom/Az.ServiceGroups.custom.psm1
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,17 @@ | ||
| # region Generated | ||
| # Load the private module dll | ||
| $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ServiceGroups.private.dll') | ||
|
|
||
| # Load the internal module | ||
| $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.ServiceGroups.internal.psm1' | ||
| if(Test-Path $internalModulePath) { | ||
| $null = Import-Module -Name $internalModulePath | ||
| } | ||
|
|
||
| # Export nothing to clear implicit exports | ||
| Export-ModuleMember | ||
|
|
||
| # Export script cmdlets | ||
| Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } | ||
| Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias) | ||
| # endregion |
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,41 @@ | ||
| # Custom | ||
| This directory contains custom implementation for non-generated cmdlets for the `Az.ServiceGroups` 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.ServiceGroups.custom.psm1`. This file should not be modified. | ||
|
|
||
| ## Info | ||
| - Modifiable: yes | ||
| - Generated: partial | ||
| - Committed: yes | ||
| - Packaged: yes | ||
|
|
||
| ## Details | ||
| For `Az.ServiceGroups` 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*. | ||
|
|
||
| For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.ServiceGroups.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. | ||
|
|
||
| For script cmdlets, these are loaded via the `Az.ServiceGroups.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. | ||
|
|
||
| ## Purpose | ||
| 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. | ||
|
|
||
| ## Usage | ||
| 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: | ||
| - Break | ||
| - DefaultProfile | ||
| - HttpPipelineAppend | ||
| - HttpPipelinePrepend | ||
| - Proxy | ||
| - ProxyCredential | ||
| - ProxyUseDefaultCredentials | ||
|
|
||
| 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.ServiceGroups`. For C#, follow the usage seen in the `ProcessRecordAsync` method. | ||
|
|
||
| ### Attributes | ||
| For processing the cmdlets, we've created some additional attributes: | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.ServiceGroups.DescriptionAttribute` | ||
| - 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. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.ServiceGroups.DoNotExportAttribute` | ||
| - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ServiceGroups`. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.ServiceGroups.InternalExportAttribute` | ||
| - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.ServiceGroups`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.ServiceGroups.ProfileAttribute` | ||
| - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. |
28 changes: 28 additions & 0 deletions
28
src/ServiceGroups/ServiceGroups.Autorest/docs/Az.ServiceGroups.md
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,28 @@ | ||
| --- | ||
| Module Name: Az.ServiceGroups | ||
| Module Guid: f41823c6-d8a5-433a-96b0-8e67f7a8dccd | ||
| Download Help Link: https://learn.microsoft.com/powershell/module/az.servicegroups | ||
| Help Version: 1.0.0.0 | ||
| Locale: en-US | ||
| --- | ||
|
|
||
| # Az.ServiceGroups Module | ||
| ## Description | ||
| Microsoft Azure PowerShell: ServiceGroups cmdlets | ||
|
|
||
| ## Az.ServiceGroups Cmdlets | ||
| ### [Get-AzServiceGroup](Get-AzServiceGroup.md) | ||
| Get the details of the serviceGroup | ||
|
|
||
| ### [Get-AzServiceGroupAncestor](Get-AzServiceGroupAncestor.md) | ||
| Get the details of the serviceGroup's ancestors | ||
|
|
||
| ### [New-AzServiceGroup](New-AzServiceGroup.md) | ||
| Create a serviceGroup | ||
|
|
||
| ### [Remove-AzServiceGroup](Remove-AzServiceGroup.md) | ||
| Delete a ServiceGroup | ||
|
|
||
| ### [Update-AzServiceGroup](Update-AzServiceGroup.md) | ||
| Update a serviceGroup | ||
|
|
127 changes: 127 additions & 0 deletions
127
src/ServiceGroups/ServiceGroups.Autorest/docs/Get-AzServiceGroup.md
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,127 @@ | ||
| --- | ||
| external help file: | ||
| Module Name: Az.ServiceGroups | ||
| online version: https://learn.microsoft.com/powershell/module/az.servicegroups/get-azservicegroup | ||
| schema: 2.0.0 | ||
| --- | ||
|
|
||
| # Get-AzServiceGroup | ||
|
|
||
| ## SYNOPSIS | ||
| Get the details of the serviceGroup | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ### Get (Default) | ||
| ``` | ||
| Get-AzServiceGroup -Name <String> [-DefaultProfile <PSObject>] [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ### GetViaIdentity | ||
| ``` | ||
| Get-AzServiceGroup -InputObject <IServiceGroupsIdentity> [-DefaultProfile <PSObject>] [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## DESCRIPTION | ||
| Get the details of the serviceGroup | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| ### Example 1: Get a service group by name | ||
| ```powershell | ||
| Get-AzServiceGroup -Name "Contoso" | ||
| ``` | ||
|
|
||
| ```output | ||
| DisplayName : Contoso Group | ||
| Id : /providers/Microsoft.Management/serviceGroups/Contoso | ||
| Kind : | ||
| Name : Contoso | ||
| ParentResourceId : /providers/Microsoft.Management/serviceGroups/00000000-0000-0000-0000-000000000000 | ||
| ProvisioningState : Succeeded | ||
| Type : Microsoft.Management/serviceGroups | ||
| ``` | ||
|
|
||
| Gets the details of the service group named 'Contoso', including its display name, parent, and provisioning state. | ||
|
|
||
| ### Example 2: Get a service group using identity input | ||
| ```powershell | ||
| $inputObject = @{ServiceGroupName = "Contoso"} | ||
| Get-AzServiceGroup -InputObject $inputObject | ||
| ``` | ||
|
|
||
| ```output | ||
| DisplayName : Contoso Group | ||
| Id : /providers/Microsoft.Management/serviceGroups/Contoso | ||
| Kind : | ||
| Name : Contoso | ||
| ParentResourceId : /providers/Microsoft.Management/serviceGroups/00000000-0000-0000-0000-000000000000 | ||
| ProvisioningState : Succeeded | ||
| Type : Microsoft.Management/serviceGroups | ||
| ``` | ||
|
|
||
| Gets a service group by constructing an identity object as input. | ||
|
|
||
| ## PARAMETERS | ||
|
|
||
| ### -DefaultProfile | ||
| The DefaultProfile parameter is not functional. | ||
| Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. | ||
|
|
||
| ```yaml | ||
| Type: System.Management.Automation.PSObject | ||
| Parameter Sets: (All) | ||
| Aliases: AzureRMContext, AzureCredential | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -InputObject | ||
| Identity Parameter | ||
|
|
||
| ```yaml | ||
| Type: Microsoft.Azure.PowerShell.Cmdlets.ServiceGroups.Models.IServiceGroupsIdentity | ||
| Parameter Sets: GetViaIdentity | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: True (ByValue) | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -Name | ||
| ServiceGroup Name. | ||
|
|
||
| ```yaml | ||
| Type: System.String | ||
| Parameter Sets: Get | ||
| Aliases: ServiceGroupName | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### CommonParameters | ||
| This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
|
|
||
| ## INPUTS | ||
|
|
||
| ### Microsoft.Azure.PowerShell.Cmdlets.ServiceGroups.Models.IServiceGroupsIdentity | ||
|
|
||
| ## OUTPUTS | ||
|
|
||
| ### Microsoft.Azure.PowerShell.Cmdlets.ServiceGroups.Models.IServiceGroup | ||
|
|
||
| ## NOTES | ||
|
|
||
| ## RELATED LINKS | ||
|
|
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.