Skip to content

Commit

Permalink
Change the name of sub-module
Browse files Browse the repository at this point in the history
  • Loading branch information
wyunchi-ms committed Apr 12, 2024
1 parent efdfd0f commit 3c852a4
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
@{
GUID = '405fa9b2-77ec-4b07-8793-e29abba71a28'
RootModule = './Az.Metric.psm1'
GUID = '6e395470-cf8e-4098-be2f-49b35f96c5a6'
RootModule = './Az.Metricdata.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: Metric cmdlets'
Description = 'Microsoft Azure PowerShell: Metricdata cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Metric.private.dll'
FormatsToProcess = './Az.Metric.format.ps1xml'
RequiredAssemblies = './bin/Az.Metricdata.private.dll'
FormatsToProcess = './Az.Metricdata.format.ps1xml'
FunctionsToExport = 'Get-AzMetricsBatch'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Metric'
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Metricdata'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
Expand Down
12 changes: 4 additions & 8 deletions src/Monitor/MetricsData.Autorest/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<!-- region Generated -->
# Az.Metric
This directory contains the PowerShell module for the Metric service.
# Az.Metricdata
This directory contains the PowerShell module for the Metricdata service.

---
## Status
[![Az.Metric](https://img.shields.io/powershellgallery/v/Az.Metric.svg?style=flat-square&label=Az.Metric "Az.Metric")](https://www.powershellgallery.com/packages/Az.Metric/)

## Info
- Modifiable: yes
- Generated: all
Expand All @@ -23,7 +20,7 @@ This module was primarily generated via [AutoRest](https://github.com/Azure/auto
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.Metric`, see [how-to.md](how-to.md).
For information on how to develop for `Az.Metricdata`, see [how-to.md](how-to.md).
<!-- endregion -->

### AutoRest Configuration
Expand All @@ -40,8 +37,7 @@ input-file:
- $(repo)/specification/monitor/data-plane/Microsoft.Insights/stable/2023-10-01/metricBatch.json

root-module-name: $(prefix).Monitor
title: Metric
module-name: Az.Metric
title: Metricdata
module-version: 0.1.0
subject-prefix: ""

Expand Down
22 changes: 11 additions & 11 deletions src/Monitor/MetricsData.Autorest/custom/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Custom
This directory contains custom implementation for non-generated cmdlets for the `Az.Metric` 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.Metric.custom.psm1`. This file should not be modified.
This directory contains custom implementation for non-generated cmdlets for the `Az.Metricdata` 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.Metricdata.custom.psm1`. This file should not be modified.

## Info
- Modifiable: yes
Expand All @@ -8,11 +8,11 @@ This directory contains custom implementation for non-generated cmdlets for the
- Packaged: yes

## Details
For `Az.Metric` 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 `Az.Metricdata` 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.Metric.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 C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.Metricdata.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.Metric.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.
For script cmdlets, these are loaded via the `Az.Metricdata.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.
Expand All @@ -27,15 +27,15 @@ The easiest way currently to start developing custom cmdlets is to copy an exist
- 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.Metric`. For C#, follow the usage seen in the `ProcessRecordAsync` method.
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.Metricdata`. 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.Metric.DescriptionAttribute`
- `Microsoft.Azure.PowerShell.Cmdlets.Metricdata.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.Metric.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Metric`.
- `Microsoft.Azure.PowerShell.Cmdlets.Metric.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Metric`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.Metric.ProfileAttribute`
- `Microsoft.Azure.PowerShell.Cmdlets.Metricdata.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Metricdata`.
- `Microsoft.Azure.PowerShell.Cmdlets.Metricdata.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Metricdata`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.Metricdata.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
Module Name: Az.Metric
Module Guid: 405fa9b2-77ec-4b07-8793-e29abba71a28
Download Help Link: https://learn.microsoft.com/powershell/module/az.metric
Module Name: Az.Metricdata
Module Guid: 6e395470-cf8e-4098-be2f-49b35f96c5a6
Download Help Link: https://learn.microsoft.com/powershell/module/az.metricdata
Help Version: 1.0.0.0
Locale: en-US
---

# Az.Metric Module
# Az.Metricdata Module
## Description
Microsoft Azure PowerShell: Metric cmdlets
Microsoft Azure PowerShell: Metricdata cmdlets

## Az.Metric Cmdlets
## Az.Metricdata Cmdlets
### [Get-AzMetricsBatch](Get-AzMetricsBatch.md)
Lists the metric values for multiple resources.

4 changes: 2 additions & 2 deletions src/Monitor/MetricsData.Autorest/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Docs
This directory contains the documentation of the cmdlets for the `Az.Metric` 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.
This directory contains the documentation of the cmdlets for the `Az.Metricdata` 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.

## Info
- Modifiable: no
Expand All @@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.Metric` mod
- Packaged: yes

## Details
The process of documentation generation loads `Az.Metric` 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.
The process of documentation generation loads `Az.Metricdata` 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.
18 changes: 9 additions & 9 deletions src/Monitor/MetricsData.Autorest/how-to.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# How-To
This document describes how to develop for `Az.Metric`.
This document describes how to develop for `Az.Metricdata`.

## Building `Az.Metric`
## Building `Az.Metricdata`
To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder.

## Creating custom cmdlets
Expand All @@ -10,18 +10,18 @@ To add cmdlets that were not generated by the REST specification, use the `custo
## Generating documentation
To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder.

## Testing `Az.Metric`
## Testing `Az.Metricdata`
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder.

## Packing `Az.Metric`
To pack `Az.Metric` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
## Packing `Az.Metricdata`
To pack `Az.Metricdata` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.

## Module Script Details
There are multiple scripts created for performing different actions for developing `Az.Metric`.
There are multiple scripts created for performing different actions for developing `Az.Metricdata`.
- `build-module.ps1`
- Builds the module DLL (`./bin/Az.Metric.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.Metric.psd1` with Azure profile information.
- Builds the module DLL (`./bin/Az.Metricdata.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.Metricdata.psd1` with Azure profile information.
- **Parameters**: [`Switch` parameters]
- `-Run`: After building, creates an isolated PowerShell session and loads `Az.Metric`.
- `-Run`: After building, creates an isolated PowerShell session and loads `Az.Metricdata`.
- `-Test`: After building, runs the `Pester` tests defined in the `test` folder.
- `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder.
- `-Pack`: After building, packages the module into a `.nupkg`.
Expand All @@ -30,7 +30,7 @@ There are multiple scripts created for performing different actions for developi
- `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process.
- `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process.
- `run-module.ps1`
- Creates an isolated PowerShell session and loads `Az.Metric` into the session.
- Creates an isolated PowerShell session and loads `Az.Metricdata` into the session.
- Same as `-Run` in `build-module.ps1`.
- **Parameters**: [`Switch` parameters]
- `-Code`: Opens a VSCode window with the module's directory.
Expand Down

0 comments on commit 3c852a4

Please sign in to comment.