Skip to content

Migrate CustomLocation from generation to main #23712

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 3 commits into from
Dec 12, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

Large diffs are not rendered by default.

151 changes: 20 additions & 131 deletions src/CustomLocation/CustomLocation.Autorest/Az.CustomLocation.psd1
Original file line number Diff line number Diff line change
@@ -1,134 +1,23 @@
#
# Module manifest for module 'Az.CustomLocation'
#
# Generated by: Microsoft Corporation
#
# Generated on: 10/28/2021
#

@{

# Script module or binary module file associated with this manifest.
RootModule = './Az.CustomLocation.psm1'

# Version number of this module.
ModuleVersion = '0.1.0'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'

# ID used to uniquely identify this module
GUID = 'b5a68592-6b36-4d8f-b582-a157eb4dfacf'

# Author of this module
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Microsoft Corporation'

# Copyright statement for this module
Copyright = 'Microsoft Corporation. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Microsoft Azure PowerShell: CustomLocation cmdlets'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '5.1'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
DotNetFrameworkVersion = '4.7.2'

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.7.4'; })

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = './bin/Az.CustomLocation.private.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = './Az.CustomLocation.format.ps1xml'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Get-AzCustomLocation', 'Get-AzCustomLocationEnabledResourceType',
'New-AzCustomLocation', 'Remove-AzCustomLocation',
'Update-AzCustomLocation'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
# VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

GUID = 'b5a68592-6b36-4d8f-b582-a157eb4dfacf'
RootModule = './Az.CustomLocation.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: CustomLocation cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.CustomLocation.private.dll'
FormatsToProcess = './Az.CustomLocation.format.ps1xml'
FunctionsToExport = 'Find-AzCustomLocationTargetResourceGroup', 'Get-AzCustomLocation', 'Get-AzCustomLocationEnabledResourceType', 'Get-AzCustomLocationResourceSyncRule', 'New-AzCustomLocation', 'New-AzCustomLocationMatchExpressionsObject', 'New-AzCustomLocationResourceSyncRule', 'Remove-AzCustomLocation', 'Remove-AzCustomLocationResourceSyncRule', 'Update-AzCustomLocation', 'Update-AzCustomLocationResourceSyncRule'
PrivateData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Azure','ResourceManager','ARM','PSModule','CustomLocation'

# A URL to the license for this module.
LicenseUri = 'https://aka.ms/azps-license'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/Azure/azure-powershell'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'First preview release for module Az.CustomLocation'

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'CustomLocation'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
}
}
if(-not $accountsModule) {
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0
if($hasAdequateVersion) {
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru
}
}
}

if(-not $accountsModule) {
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
}
Write-Information "Loaded Module '$($accountsModule.Name)'"

Expand All @@ -50,6 +50,10 @@

# Tweaks the pipeline on module load
$instance.OnModuleLoad = $VTable.OnModuleLoad

# Following two delegates are added for telemetry
$instance.GetTelemetryId = $VTable.GetTelemetryId
$instance.Telemetry = $VTable.Telemetry


# Tweaks the pipeline per call
Expand Down
45 changes: 38 additions & 7 deletions src/CustomLocation/CustomLocation.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This directory contains the PowerShell module for the CustomLocation service.
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.2.3 or greater
- [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.
Expand All @@ -30,11 +30,11 @@ For information on how to develop for `Az.CustomLocation`, see [how-to.md](how-t
> see https://aka.ms/autorest

``` yaml
branch: c6c9e02ae4de78cd7357bc4a5a7be38e6f1909d0
commit: f1180941e238bc99ac71f9535ecd126bb8b77d8f
require:
- $(this-folder)/../readme.azure.noprofile.md
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
- $(repo)/specification/extendedlocation/resource-manager/Microsoft.ExtendedLocation/stable/2021-08-15/customlocations.json
- $(repo)/specification/extendedlocation/resource-manager/Microsoft.ExtendedLocation/preview/2021-08-31-preview/customlocations.json

module-version: 0.1.0
title: CustomLocation
Expand All @@ -59,7 +59,7 @@ directive:
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/c6c9e02ae4de78cd7357bc4a5a7be38e6f1909d0/specification/common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/f1180941e238bc99ac71f9535ecd126bb8b77d8f/specification/common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
}
}
}
Expand Down Expand Up @@ -90,9 +90,15 @@ directive:
transform: return $.replace(/\{resourceName\}\/enabledResourceTypes/g, "{resourceName}/enabledresourcetypes")

- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
variant: ^(Create|Update).*(?<!Expanded|JsonFilePath|JsonString)$
remove: true
- where:
subject: CustomLocation
variant: ^CreateViaIdentityExpanded$
remove: true
- where:
variant: ^Find$|^FindViaIdentity$
remove: true

- where:
verb: Set
remove: true
Expand Down Expand Up @@ -121,6 +127,18 @@ directive:
set:
parameter-name: Name

- where:
subject: ^CustomLocationTargetResourceGroup$|^ResourceSyncRule$
parameter-name: ResourceName
set:
parameter-name: CustomLocationName

- where:
subject: ^CustomLocationTargetResourceGroup$|^ResourceSyncRule$
parameter-name: ChildResourceName
set:
parameter-name: Name

- where:
model-name: CustomLocation
set:
Expand All @@ -129,4 +147,17 @@ directive:
- Location
- Name
- Namespace
- ResourceGroupName

- where:
model-name: EnabledResourceType
set:
format-table:
properties:
- Name
- ExtensionType

- model-cmdlet:
- model-name: MatchExpressionsProperties
cmdlet-name: New-AzCustomLocationMatchExpressionsObject
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"resourceType": "customlocations/resourceSyncRules",
"apiVersion": "2021-08-31-preview",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.customlocation"
},
"commands": [
{
"name": "Get-AzCustomLocationResourceSyncRule",
"description": "Gets the details of the resourceSyncRule with a specified resource group, subscription id Custom Location resource name and Resource Sync Rule name.",
"path": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}/resourceSyncRules/{childResourceName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.customlocation/get-azcustomlocationresourcesyncrule"
},
"parameterSets": [
{
"parameters": [
"-CustomLocationName <String>",
"-Name <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
}
]
},
"examples": [
{
"description": "Gets the details of the resourceSyncRule with a specified resource group, subscription id Custom Location resource name and Resource Sync Rule name.",
"parameters": [
{
"name": "-CustomLocationName",
"value": "[Path.resourceName]"
},
{
"name": "-Name",
"value": "[Path.childResourceName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
},
{
"name": "Remove-AzCustomLocationResourceSyncRule",
"description": "Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id.",
"path": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}/resourceSyncRules/{childResourceName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.customlocation/remove-azcustomlocationresourcesyncrule"
},
"parameterSets": [
{
"parameters": [
"-CustomLocationName <String>",
"-Name <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String>]"
]
}
]
},
"examples": [
{
"description": "Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id.",
"parameters": [
{
"name": "-CustomLocationName",
"value": "[Path.resourceName]"
},
{
"name": "-Name",
"value": "[Path.childResourceName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "customlocations",
"apiVersion": "2021-08-15",
"apiVersion": "2021-08-31-preview",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.customlocation"
},
Expand Down
Loading