Skip to content
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

Private Marketplace - Sync APIs with swagger 2023-01-01 and adds tests #24114

Merged
Merged
3 changes: 1 addition & 2 deletions src/Marketplace/Marketplace.Autorest/Az.Marketplace.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Marketplace.private.dll'
FormatsToProcess = './Az.Marketplace.format.ps1xml'
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', '*'
AliasesToExport = '*'
FunctionsToExport = 'Copy-AzMarketplacePrivateStoreCollectionOffer', 'Disable-AzMarketplacePrivateStoreCollectionAllItem', 'Enable-AzMarketplacePrivateStoreCollectionAllItem', 'Get-AzMarketplaceBillingPrivateStoreAccount', 'Get-AzMarketplaceCollectionToSubscriptionMapping', 'Get-AzMarketplacePrivateStoreAllSubscriptionInTenant', 'Get-AzMarketplacePrivateStoreCollection', 'Get-AzMarketplacePrivateStoreCollectionMapOffersToContext', 'Get-AzMarketplacePrivateStoreCollectionOffer', 'Get-AzMarketplacePrivateStoreCollectionRule', 'Get-AzMarketplacePrivateStoreNewPlanNotification', 'Get-AzMarketplacePrivateStoreStopSellOfferPlanNotification', 'Get-AzMarketplacePrivateStoreSubscription', 'Get-AzMarketplacePrivateStoreUserOffer', 'Get-AzMarketplacePrivateStoreUserRule', 'Get-AzMarketplacePrivateStoreV1', 'Get-AzMarketplaceQueryPrivateStoreOffer', 'New-AzMarketplacePrivateStore', 'New-AzMarketplacePrivateStoreCollection', 'New-AzMarketplacePrivateStoreCollectionOffer', 'New-AzMarketplacePrivateStoreCollectionOfferMultiContext', 'New-AzMarketplacePrivateStoreCollectionRule', 'Remove-AzMarketplacePrivateStoreCollection', 'Remove-AzMarketplacePrivateStoreCollectionOffer', 'Set-AzMarketplaceBulkPrivateStoreCollectionAction', 'Set-AzMarketplacePrivateStore', 'Set-AzMarketplacePrivateStoreCollection', 'Set-AzMarketplacePrivateStoreCollectionOffer', 'Test-AzMarketplacePrivateStoreAnyExistingOffer', 'Update-AzMarketplacePrivateStoreCollection', 'Update-AzMarketplacePrivateStoreCollectionOffer'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Marketplace'
Expand Down
150 changes: 139 additions & 11 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,19 +38,17 @@ In this directory, run AutoRest:
require:
- $(this-folder)/../../readme.azure.noprofile.md
# lock the commit
commit: 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

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"
use-extension:
"@autorest/powershell": "4.x"

directive:
# Remove the unexpanded parameter set
Expand Down Expand Up @@ -105,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 @@ -161,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
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"resourceType": "privateStores/collections",
"apiVersion": "2021-06-01",
"apiVersion": "2023-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace"
},
"commands": [
{
"name": "Copy-AzMarketplacePrivateStoreCollectionOffer",
"description": "transferring offers (copy or move) from source collection to target collection(s)",
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers",
"name": "Disable-AzMarketplacePrivateStoreCollectionAllItem",
"description": "Disable approve all items for the collection.",
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/copy-azmarketplaceprivatestorecollectionoffer"
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem"
},
"parameterSets": [
{
Expand All @@ -24,7 +24,73 @@
},
"examples": [
{
"description": "transferring offers (copy or move) from source collection to target collection(s)",
"description": "Disable approve all items for the collection.",
"parameters": [
{
"name": "-CollectionId",
"value": "[Path.collectionId]"
},
{
"name": "-PrivateStoreId",
"value": "[Path.privateStoreId]"
}
]
}
]
},
{
"name": "Enable-AzMarketplacePrivateStoreCollectionAllItem",
"description": "Delete all existing offers from the collection and enable approve all items.",
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem"
},
"parameterSets": [
{
"parameters": [
"-CollectionId <String>",
"-PrivateStoreId <String>"
]
}
]
},
"examples": [
{
"description": "Delete all existing offers from the collection and enable approve all items.",
"parameters": [
{
"name": "-CollectionId",
"value": "[Path.collectionId]"
},
{
"name": "-PrivateStoreId",
"value": "[Path.privateStoreId]"
}
]
}
]
},
{
"name": "Get-AzMarketplacePrivateStoreCollectionRule",
"description": "Get a list of all private store rules in the given private store and collection",
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule"
},
"parameterSets": [
{
"parameters": [
"-CollectionId <String>",
"-PrivateStoreId <String>"
]
}
]
},
"examples": [
{
"description": "Get a list of all private store rules in the given private store and collection",
"parameters": [
{
"name": "-CollectionId",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "privateStores",
"apiVersion": "2021-06-01",
"apiVersion": "2023-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace"
},
Expand Down Expand Up @@ -34,12 +34,12 @@
]
},
{
"name": "Get-AzMarketplaceCollectionToSubscriptionMapping",
"description": "For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.",
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping",
"name": "Get-AzMarketplacePrivateStoreAllSubscriptionInTenant",
"description": "Fetch all subscriptions in tenant, only for marketplace admin",
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacecollectiontosubscriptionmapping"
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant"
},
"parameterSets": [
{
Expand All @@ -51,7 +51,7 @@
},
"examples": [
{
"description": "For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.",
"description": "Fetch all subscriptions in tenant, only for marketplace admin",
"parameters": [
{
"name": "-PrivateStoreId",
Expand Down Expand Up @@ -116,6 +116,34 @@
]
}
]
},
{
"name": "Test-AzMarketplacePrivateStoreAnyExistingOffer",
"description": "Query whether exists any offer in the collections.",
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer"
},
"parameterSets": [
{
"parameters": [
"-PrivateStoreId <String>"
]
}
]
},
"examples": [
{
"description": "Query whether exists any offer in the collections.",
"parameters": [
{
"name": "-PrivateStoreId",
"value": "[Path.privateStoreId]"
}
]
}
]
}
]
}
Loading