Skip to content

Commit 96a394d

Browse files
authored
Tsp - Fixed an enum related issue (#1421)
* Tsp - Fixed an enum related issue * Delete tests-upgrade/tests-emitter/EdgeZones.Management/target/custom/Az.DeviceRegistry.custom.psm1 Remove an unused file
1 parent bcb7e88 commit 96a394d

File tree

225 files changed

+2493
-2502
lines changed

Some content is hidden

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

225 files changed

+2493
-2502
lines changed

packages/typespec-powershell/src/utils/modelUtils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,10 +1128,8 @@ function getSchemaForEnum(dpgContext: SdkContext, e: Enum) {
11281128
function enumMemberType(member: EnumMember | undefined) {
11291129
if (typeof member?.value === "number") {
11301130
return "number";
1131-
} else if (typeof member?.value === "string") {
1132-
return "string";
11331131
}
1134-
return undefined;
1132+
return "string";
11351133
}
11361134
/**
11371135
* Map TypeSpec intrinsic models to open api definitions

tests-upgrade/tests-emitter/EdgeZones.Management/target/Az.DeviceRegistry.csproj renamed to tests-upgrade/tests-emitter/EdgeZones.Management/target/Az.EdgeZones.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<LangVersion>7.1</LangVersion>
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<OutputType>Library</OutputType>
8-
<AssemblyName>Az.DeviceRegistry.private</AssemblyName>
8+
<AssemblyName>Az.EdgeZones.private</AssemblyName>
99
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
10-
<RootNamespace>Microsoft.Azure.PowerShell.Cmdlets.DeviceRegistry</RootNamespace>
10+
<RootNamespace>Microsoft.Azure.PowerShell.Cmdlets.EdgeZones</RootNamespace>
1111
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1212
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1313
<OutputPath>./bin</OutputPath>
1414
<PublishDir>$(OutputPath)</PublishDir>
15-
<NuspecFile>Az.DeviceRegistry.nuspec</NuspecFile>
15+
<NuspecFile>Az.EdgeZones.nuspec</NuspecFile>
1616
<NoPackageAnalysis>true</NoPackageAnalysis>
1717
<!-- Some methods are marked async and don't have an await in them -->
1818
<!-- warning CS1591: Missing XML comment for publicly visible type or member -->

tests-upgrade/tests-emitter/EdgeZones.Management/target/Az.DeviceRegistry.nuspec renamed to tests-upgrade/tests-emitter/EdgeZones.Management/target/Az.EdgeZones.nuspec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
33
<metadata>
4-
<id>Az.DeviceRegistry</id>
4+
<id>Az.EdgeZones</id>
55
<version>0.1.0</version>
66
<authors>Microsoft Corporation</authors>
77
<owners>Microsoft Corporation</owners>
88
<requireLicenseAcceptance>true</requireLicenseAcceptance>
99
<licenseUrl>https://aka.ms/azps-license</licenseUrl>
1010
<projectUrl>https://github.com/Azure/azure-powershell</projectUrl>
11-
<description>Microsoft Azure PowerShell: DeviceRegistry cmdlets</description>
11+
<description>Microsoft Azure PowerShell: EdgeZones cmdlets</description>
1212
<releaseNotes></releaseNotes>
1313
<copyright>Microsoft Corporation. All rights reserved.</copyright>
1414
<tags>Azure ResourceManager ARM PSModule Sphere</tags>
@@ -17,12 +17,12 @@
1717
</dependencies>
1818
</metadata>
1919
<files>
20-
<file src="Az.DeviceRegistry.format.ps1xml" />
21-
<file src="Az.DeviceRegistry.psd1" />
22-
<file src="Az.DeviceRegistry.psm1" />
20+
<file src="Az.EdgeZones.format.ps1xml" />
21+
<file src="Az.EdgeZones.psd1" />
22+
<file src="Az.EdgeZones.psm1" />
2323
<!-- https://github.com/NuGet/Home/issues/3584 -->
24-
<file src="bin/Az.DeviceRegistry.private.dll" target="bin" />
25-
<file src="bin\Az.DeviceRegistry.private.deps.json" target="bin" />
24+
<file src="bin/Az.EdgeZones.private.dll" target="bin" />
25+
<file src="bin\Az.EdgeZones.private.deps.json" target="bin" />
2626
<file src="internal\**\*.*" exclude="internal\README.md" target="internal" />
2727
<file src="custom\**\*.*" exclude="custom\README.md;custom\**\*.cs" target="custom" />
2828
<file src="docs\**\*.md" exclude="docs\README.md" target="docs" />

tests-upgrade/tests-emitter/EdgeZones.Management/target/Az.DeviceRegistry.psm1 renamed to tests-upgrade/tests-emitter/EdgeZones.Management/target/Az.EdgeZones.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
Write-Information "Loaded Module '$($accountsModule.Name)'"
4141

4242
# Load the private module dll
43-
$null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.DeviceRegistry.private.dll')
43+
$null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.EdgeZones.private.dll')
4444

4545
# Get the private module's instance
46-
$instance = [Microsoft.Azure.PowerShell.Cmdlets.DeviceRegistry.Module]::Instance
46+
$instance = [Microsoft.Azure.PowerShell.Cmdlets.EdgeZones.Module]::Instance
4747

4848
# Ask for the shared functionality table
4949
$VTable = Register-AzModule
@@ -77,7 +77,7 @@
7777
$instance.ProfileName = $VTable.ProfileName
7878

7979
# Load the custom module
80-
$customModulePath = Join-Path $PSScriptRoot './custom/Az.DeviceRegistry.custom.psm1'
80+
$customModulePath = Join-Path $PSScriptRoot './custom/Az.EdgeZones.custom.psm1'
8181
if(Test-Path $customModulePath) {
8282
$null = Import-Module -Name $customModulePath
8383
}

tests-upgrade/tests-emitter/EdgeZones.Management/target/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- region Generated -->
2-
# Az.DeviceRegistry
3-
This directory contains the PowerShell module for the DeviceRegistry service.
2+
# Az.EdgeZones
3+
This directory contains the PowerShell module for the EdgeZones service.
44

55
---
66
## Info
@@ -20,5 +20,5 @@ This module was primarily generated via [AutoRest](https://github.com/Azure/auto
2020
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
2121

2222
## Development
23-
For information on how to develop for `Az.DeviceRegistry`, see [how-to.md](how-to.md).
23+
For information on how to develop for `Az.EdgeZones`, see [how-to.md](how-to.md).
2424
<!-- endregion -->

tests-upgrade/tests-emitter/EdgeZones.Management/target/build-module.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ if(-not $Debugger) {
9999
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release')
100100
}
101101

102-
$dll = Join-Path $PSScriptRoot 'bin\Az.DeviceRegistry.private.dll'
102+
$dll = Join-Path $PSScriptRoot 'bin\Az.EdgeZones.private.dll'
103103
if(-not (Test-Path $dll)) {
104104
Write-Error "Unable to find output assembly in '$binFolder'."
105105
}
@@ -108,7 +108,7 @@ if(-not (Test-Path $dll)) {
108108
$null = Import-Module -Name $dll
109109

110110
$modulePaths = $dll
111-
$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.DeviceRegistry.custom.psm1'
111+
$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.EdgeZones.custom.psm1'
112112
if(Test-Path $customPsm1) {
113113
$modulePaths = @($dll, $customPsm1)
114114
}
@@ -125,9 +125,9 @@ if(Test-Path $internalFolder) {
125125
}
126126
$null = New-Item -ItemType Directory -Force -Path $internalFolder
127127

128-
$psd1 = Join-Path $PSScriptRoot './Az.DeviceRegistry.psd1'
128+
$psd1 = Join-Path $PSScriptRoot './Az.EdgeZones.psd1'
129129
$guid = Get-ModuleGuid -Psd1Path $psd1
130-
$moduleName = 'Az.DeviceRegistry'
130+
$moduleName = 'Az.EdgeZones'
131131
$examplesFolder = Join-Path $PSScriptRoot 'examples'
132132
$null = New-Item -ItemType Directory -Force -Path $examplesFolder
133133

@@ -147,7 +147,7 @@ if($NoDocs) {
147147
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder
148148
} else {
149149
Write-Host -ForegroundColor Green 'Creating exports and docs...'
150-
$moduleDescription = 'Microsoft Azure PowerShell: DeviceRegistry cmdlets'
150+
$moduleDescription = 'Microsoft Azure PowerShell: EdgeZones cmdlets'
151151
$docsFolder = Join-Path $PSScriptRoot 'docs'
152152
if(Test-Path $docsFolder) {
153153
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
@@ -158,7 +158,7 @@ if($NoDocs) {
158158
}
159159

160160
Write-Host -ForegroundColor Green 'Creating format.ps1xml...'
161-
$formatPs1xml = Join-Path $PSScriptRoot './Az.DeviceRegistry.format.ps1xml'
161+
$formatPs1xml = Join-Path $PSScriptRoot './Az.EdgeZones.format.ps1xml'
162162
Export-FormatPs1xml -FilePath $formatPs1xml
163163

164164
Write-Host -ForegroundColor Green 'Creating psd1...'

tests-upgrade/tests-emitter/EdgeZones.Management/target/create-model-cmdlets.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function CreateModelCmdlet {
2828
if (''.length -gt 0) {
2929
$ModuleName = ''
3030
} else {
31-
$ModuleName = 'Az.DeviceRegistry'
31+
$ModuleName = 'Az.EdgeZones'
3232
}
3333
$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
3434
$Content = ''
@@ -86,10 +86,10 @@ function CreateModelCmdlet {
8686
$ObjectType = $ModelName
8787
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
8888
# remove duplicated module name
89-
if ($ObjectType.StartsWith('DeviceRegistry')) {
89+
if ($ObjectType.StartsWith('EdgeZones')) {
9090
$ModulePrefix = ''
9191
} else {
92-
$ModulePrefix = 'DeviceRegistry'
92+
$ModulePrefix = 'EdgeZones'
9393
}
9494
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir
9595

tests-upgrade/tests-emitter/EdgeZones.Management/target/custom/Az.DeviceRegistry.custom.psm1 renamed to tests-upgrade/tests-emitter/EdgeZones.Management/target/custom/Az.EdgeZones.custom.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# region Generated
22
# Load the private module dll
3-
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.DeviceRegistry.private.dll')
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.EdgeZones.private.dll')
44

55
# Load the internal module
6-
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.DeviceRegistry.internal.psm1'
6+
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.EdgeZones.internal.psm1'
77
if(Test-Path $internalModulePath) {
88
$null = Import-Module -Name $internalModulePath
99
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Custom
2-
This directory contains custom implementation for non-generated cmdlets for the `Az.DeviceRegistry` 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.DeviceRegistry.custom.psm1`. This file should not be modified.
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.EdgeZones` 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.EdgeZones.custom.psm1`. This file should not be modified.
33

44
## Info
55
- Modifiable: yes
@@ -8,11 +8,11 @@ This directory contains custom implementation for non-generated cmdlets for the
88
- Packaged: yes
99

1010
## Details
11-
For `Az.DeviceRegistry` 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*.
11+
For `Az.EdgeZones` 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*.
1212

13-
For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.DeviceRegistry.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.
13+
For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.EdgeZones.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.
1414

15-
For script cmdlets, these are loaded via the `Az.DeviceRegistry.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.
15+
For script cmdlets, these are loaded via the `Az.EdgeZones.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.
1616

1717
## Purpose
1818
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.
@@ -27,15 +27,15 @@ The easiest way currently to start developing custom cmdlets is to copy an exist
2727
- ProxyCredential
2828
- ProxyUseDefaultCredentials
2929

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.DeviceRegistry`. For C#, follow the usage seen in the `ProcessRecordAsync` method.
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.EdgeZones`. For C#, follow the usage seen in the `ProcessRecordAsync` method.
3131

3232
### Attributes
3333
For processing the cmdlets, we've created some additional attributes:
34-
- `Microsoft.Azure.PowerShell.Cmdlets.DeviceRegistry.DescriptionAttribute`
34+
- `Microsoft.Azure.PowerShell.Cmdlets.EdgeZones.DescriptionAttribute`
3535
- 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.DeviceRegistry.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.DeviceRegistry`.
38-
- `Microsoft.Azure.PowerShell.Cmdlets.DeviceRegistry.InternalExportAttribute`
39-
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.DeviceRegistry`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
40-
- `Microsoft.Azure.PowerShell.Cmdlets.DeviceRegistry.ProfileAttribute`
36+
- `Microsoft.Azure.PowerShell.Cmdlets.EdgeZones.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.EdgeZones`.
38+
- `Microsoft.Azure.PowerShell.Cmdlets.EdgeZones.InternalExportAttribute`
39+
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.EdgeZones`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
40+
- `Microsoft.Azure.PowerShell.Cmdlets.EdgeZones.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Docs
2-
This directory contains the documentation of the cmdlets for the `Az.DeviceRegistry` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder.
2+
This directory contains the documentation of the cmdlets for the `Az.EdgeZones` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder.
33

44
## Info
55
- Modifiable: no
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.DeviceRegis
88
- Packaged: yes
99

1010
## Details
11-
The process of documentation generation loads `Az.DeviceRegistry` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.
11+
The process of documentation generation loads `Az.EdgeZones` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.

0 commit comments

Comments
 (0)