Skip to content

Migrate Marketplace from generation to main #24127

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 2 commits into from
Feb 7, 2024
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
  •  
  •  
  •  
646 changes: 420 additions & 226 deletions src/Marketplace/Marketplace.Autorest/Az.Marketplace.format.ps1xml

Large diffs are not rendered by default.

164 changes: 20 additions & 144 deletions src/Marketplace/Marketplace.Autorest/Az.Marketplace.psd1
Original file line number Diff line number Diff line change
@@ -1,147 +1,23 @@
#
# Module manifest for module 'Az.Marketplace'
#
# Generated by: Microsoft Corporation
#
# Generated on: 1/27/2022
#

@{

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

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

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

# ID used to uniquely identify this module
GUID = '4db1f51a-b835-4783-be47-0b8939492ea5'

# 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: Marketplace 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.Marketplace.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.Marketplace.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 = 'Copy-AzMarketplacePrivateStoreCollectionOffer',
'Get-AzMarketplaceBillingPrivateStoreAccount',
'Get-AzMarketplaceCollectionToSubscriptionMapping',
'Get-AzMarketplacePrivateStoreCollection',
'Get-AzMarketplacePrivateStoreCollectionOffer',
'Get-AzMarketplacePrivateStoreV1',
'Get-AzMarketplaceQueryPrivateStoreOffer',
'New-AzMarketplacePrivateStore',
'New-AzMarketplacePrivateStoreCollection',
'New-AzMarketplacePrivateStoreCollectionOffer',
'Remove-AzMarketplacePrivateStoreCollection',
'Remove-AzMarketplacePrivateStoreCollectionOffer',
'Set-AzMarketplaceBulkPrivateStoreCollectionAction',
'Set-AzMarketplacePrivateStore',
'Set-AzMarketplacePrivateStoreCollection',
'Set-AzMarketplacePrivateStoreCollectionOffer'

# 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 = '4db1f51a-b835-4783-be47-0b8939492ea5'
RootModule = './Az.Marketplace.psm1'
ModuleVersion = '1.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: Marketplace cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Marketplace.private.dll'
FormatsToProcess = './Az.Marketplace.format.ps1xml'
FunctionsToExport = 'Copy-AzMarketplacePrivateStoreCollectionOffer', 'Disable-AzMarketplacePrivateStoreCollectionAllItem', 'Enable-AzMarketplacePrivateStoreCollectionAllItem', 'Get-AzMarketplaceBillingPrivateStoreAccount', 'Get-AzMarketplaceCollectionToSubscriptionMapping', 'Get-AzMarketplacePrivateStoreAllSubscriptionInTenant', 'Get-AzMarketplacePrivateStoreCollection', 'Get-AzMarketplacePrivateStoreCollectionMapOffersToContext', 'Get-AzMarketplacePrivateStoreCollectionOffer', 'Get-AzMarketplacePrivateStoreCollectionRule', 'Get-AzMarketplacePrivateStoreNewPlanNotification', 'Get-AzMarketplacePrivateStoreSubscription', 'Get-AzMarketplacePrivateStoreUserOffer', 'Get-AzMarketplacePrivateStoreUserRule', 'Get-AzMarketplacePrivateStoreV1', 'Get-AzMarketplaceQueryPrivateStoreOffer', 'New-AzMarketplacePrivateStore', 'New-AzMarketplacePrivateStoreCollection', 'New-AzMarketplacePrivateStoreCollectionOffer', 'New-AzMarketplacePrivateStoreCollectionOfferMultiContext', 'Remove-AzMarketplacePrivateStoreCollection', 'Remove-AzMarketplacePrivateStoreCollectionOffer', 'Set-AzMarketplaceBulkPrivateStoreCollectionAction', 'Set-AzMarketplacePrivateStore', 'Set-AzMarketplacePrivateStoreCollection', 'Set-AzMarketplacePrivateStoreCollectionOffer', 'Test-AzMarketplacePrivateStoreAnyExistingOffer', 'Update-AzMarketplacePrivateStoreCollection', 'Update-AzMarketplacePrivateStoreCollectionOffer'
PrivateData = @{
PSData = @{

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

# 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 = ''

# 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', 'Marketplace'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}

14 changes: 9 additions & 5 deletions src/Marketplace/Marketplace.Autorest/Az.Marketplace.psm1
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
148 changes: 140 additions & 8 deletions src/Marketplace/Marketplace.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 Marketplace 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 @@ -38,16 +38,18 @@ In this directory, run AutoRest:
require:
- $(this-folder)/../../readme.azure.noprofile.md
# lock the commit
branch: 8dc5f1df21caf602944de05e68945c2bbf009c2d
commit: a54263176acce91199a19333d6c4717367a3317e
input-file:
- $(repo)/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/Marketplace.json
- $(repo)/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2023-01-01/Marketplace.json

module-version: 1.1.0
title: Marketplace
subject-prefix: $(service-name)

inlining-threshold: 50

use-extension:
"@autorest/powershell": "4.x"

directive:
# Remove the unexpanded parameter set
- where:
Expand Down Expand Up @@ -101,11 +103,11 @@ directive:
remove: true
- where:
verb: Invoke
subject: PrivateStoreCollection
subject: ^PrivateStoreCollection$
remove: true
- where:
verb: Invoke
subject: PrivateStoreCollectionOffer
subject: ^PrivateStoreCollectionOffer$
remove: true
- where:
verb: Get
Expand Down Expand Up @@ -157,7 +159,137 @@ directive:
verb: Get
subject: PrivateStore
set:
subject: PrivateStoreV1
subject: PrivateStoreV1

# Rename POST methods
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections
- where:
verb: Invoke
subject: AnyPrivateStoreExistingOffer
set:
verb: Test
subject: PrivateStoreAnyExistingOffer
- where:
verb: Get
subject: PrivateStoreUserOffer
variant: Query(?!.*?Expanded)
remove: true

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserOffers
- where:
verb: Invoke
subject: QueryPrivateStoreUserOffer
set:
verb: Get
subject: PrivateStoreUserOffer
- where:
verb: Get
subject: PrivateStoreUserOffer
variant: Query(?!.*?Expanded)
remove: true

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules
- where:
verb: Invoke
subject: QueryUserRule
set:
verb: Get
subject: PrivateStoreUserRule
- where:
verb: Get
subject: PrivateStoreUserRule
variant: Query(?!.*?Expanded)
remove: true

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems
- where:
verb: Approve
subject: PrivateStoreCollectionItem
set:
verb: Enable
subject: PrivateStoreCollectionAllItem
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems"
- where:
verb: Disable
subject: PrivateStoreCollectionApproveItem
set:
subject: PrivateStoreCollectionAllItem

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/mapOffersToContexts
- where:
verb: Get
subject: PrivateStoreCollectionOffer
variant: ^List\S+
set:
subject: PrivateStoreCollectionMapOffersToContext
- where:
verb: Get
subject: PrivateStoreCollectionMapOffersToContext
variant: List(?!.*?Expanded)
remove: true


# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/setRules
# swagger does not match request
# - where:
# verb: Set
# subject: CollectionRule
# set:
# verb: New
# subject: PrivateStoreCollectionRule
# - where:
# verb: New
# subject: PrivateStoreCollectionRule
# variant: Set(?!.*?Expanded)
# remove: true
- where:
verb: Set
subject: CollectionRule
remove: true

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules
- where:
verb: Invoke
subject: QueryRule
set:
verb: Get
subject: PrivateStoreCollectionRule

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext
- where:
verb: Invoke
subject: OfferPrivateStoreCollectionOfferUpsert
set:
verb: New
subject: PrivateStoreCollectionOfferMultiContext
- where:
verb: New
subject: PrivateStoreCollectionOfferMultiContext
variant: Offer(?!.*?Expanded)
remove: true

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant
- where:
verb: Invoke
subject: FetchPrivateStoreSubscription
set:
verb: Get
subject: PrivateStoreAllSubscriptionInTenant

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listStopSellOffersPlansNotifications
# - where:
# verb: Get
# subject: PrivateStoreStopSellOfferPlanNotification
# variant: List(?!.*?Expanded)
# remove: true
- where:
verb: Get
subject: PrivateStoreStopSellOfferPlanNotification
remove: true

# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listSubscriptionsContext
- where:
verb: Get
subject: PrivateStoreSubscriptionContext
set:
subject: PrivateStoreSubscription
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "privateStores/collections/offers",
"apiVersion": "2021-06-01",
"apiVersion": "2023-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace"
},
Expand Down
Loading