Skip to content

Commit b2716c0

Browse files
saviesacovVeryEarlywyunchi-ms
authored
Private Marketplace - Sync APIs with swagger 2023-01-01 and adds tests (#24114)
* upgrade API version, use autorest.powershell v4 * upgrade API version * fix POST operations * phase 1 - tests till user offers * tmp1 * fix2 * clean tests * run * Update src/Marketplace/Marketplace.Autorest/README.md * env * skip and fix * examples * test record & playback * remove two APIs * remove stopsell & setrules * docs with examples --------- Co-authored-by: Yabo Hu <[email protected]> Co-authored-by: Yunchi Wang <[email protected]>
1 parent 52de9ac commit b2716c0

File tree

115 files changed

+5315
-790
lines changed

Some content is hidden

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

115 files changed

+5315
-790
lines changed

src/Marketplace/Marketplace.Autorest/Az.Marketplace.psd1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
DotNetFrameworkVersion = '4.7.2'
1212
RequiredAssemblies = './bin/Az.Marketplace.private.dll'
1313
FormatsToProcess = './Az.Marketplace.format.ps1xml'
14-
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', '*'
15-
AliasesToExport = '*'
14+
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'
1615
PrivateData = @{
1716
PSData = @{
1817
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Marketplace'

src/Marketplace/Marketplace.Autorest/README.md

Lines changed: 139 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This directory contains the PowerShell module for the Marketplace service.
1717
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
1818

1919
## Module Requirements
20-
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
20+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
2121

2222
## Authentication
2323
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
@@ -38,19 +38,17 @@ In this directory, run AutoRest:
3838
require:
3939
- $(this-folder)/../../readme.azure.noprofile.md
4040
# lock the commit
41-
commit: 8dc5f1df21caf602944de05e68945c2bbf009c2d
41+
commit: a54263176acce91199a19333d6c4717367a3317e
4242
input-file:
43-
- $(repo)/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2021-06-01/Marketplace.json
43+
- $(repo)/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2023-01-01/Marketplace.json
4444

4545
module-version: 1.1.0
4646
title: Marketplace
4747
subject-prefix: $(service-name)
48-
4948
inlining-threshold: 50
5049

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

5553
directive:
5654
# Remove the unexpanded parameter set
@@ -105,11 +103,11 @@ directive:
105103
remove: true
106104
- where:
107105
verb: Invoke
108-
subject: PrivateStoreCollection
106+
subject: ^PrivateStoreCollection$
109107
remove: true
110108
- where:
111109
verb: Invoke
112-
subject: PrivateStoreCollectionOffer
110+
subject: ^PrivateStoreCollectionOffer$
113111
remove: true
114112
- where:
115113
verb: Get
@@ -161,7 +159,137 @@ directive:
161159
verb: Get
162160
subject: PrivateStore
163161
set:
164-
subject: PrivateStoreV1
162+
subject: PrivateStoreV1
163+
164+
# Rename POST methods
165+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections
166+
- where:
167+
verb: Invoke
168+
subject: AnyPrivateStoreExistingOffer
169+
set:
170+
verb: Test
171+
subject: PrivateStoreAnyExistingOffer
172+
- where:
173+
verb: Get
174+
subject: PrivateStoreUserOffer
175+
variant: Query(?!.*?Expanded)
176+
remove: true
177+
178+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserOffers
179+
- where:
180+
verb: Invoke
181+
subject: QueryPrivateStoreUserOffer
182+
set:
183+
verb: Get
184+
subject: PrivateStoreUserOffer
185+
- where:
186+
verb: Get
187+
subject: PrivateStoreUserOffer
188+
variant: Query(?!.*?Expanded)
189+
remove: true
165190

166-
191+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules
192+
- where:
193+
verb: Invoke
194+
subject: QueryUserRule
195+
set:
196+
verb: Get
197+
subject: PrivateStoreUserRule
198+
- where:
199+
verb: Get
200+
subject: PrivateStoreUserRule
201+
variant: Query(?!.*?Expanded)
202+
remove: true
203+
204+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems
205+
- where:
206+
verb: Approve
207+
subject: PrivateStoreCollectionItem
208+
set:
209+
verb: Enable
210+
subject: PrivateStoreCollectionAllItem
211+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems"
212+
- where:
213+
verb: Disable
214+
subject: PrivateStoreCollectionApproveItem
215+
set:
216+
subject: PrivateStoreCollectionAllItem
217+
218+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/mapOffersToContexts
219+
- where:
220+
verb: Get
221+
subject: PrivateStoreCollectionOffer
222+
variant: ^List\S+
223+
set:
224+
subject: PrivateStoreCollectionMapOffersToContext
225+
- where:
226+
verb: Get
227+
subject: PrivateStoreCollectionMapOffersToContext
228+
variant: List(?!.*?Expanded)
229+
remove: true
230+
231+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/setRules
232+
# swagger does not match request
233+
# - where:
234+
# verb: Set
235+
# subject: CollectionRule
236+
# set:
237+
# verb: New
238+
# subject: PrivateStoreCollectionRule
239+
# - where:
240+
# verb: New
241+
# subject: PrivateStoreCollectionRule
242+
# variant: Set(?!.*?Expanded)
243+
# remove: true
244+
- where:
245+
verb: Set
246+
subject: CollectionRule
247+
remove: true
248+
249+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules
250+
- where:
251+
verb: Invoke
252+
subject: QueryRule
253+
set:
254+
verb: Get
255+
subject: PrivateStoreCollectionRule
256+
257+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext
258+
- where:
259+
verb: Invoke
260+
subject: OfferPrivateStoreCollectionOfferUpsert
261+
set:
262+
verb: New
263+
subject: PrivateStoreCollectionOfferMultiContext
264+
- where:
265+
verb: New
266+
subject: PrivateStoreCollectionOfferMultiContext
267+
variant: Offer(?!.*?Expanded)
268+
remove: true
269+
270+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant
271+
- where:
272+
verb: Invoke
273+
subject: FetchPrivateStoreSubscription
274+
set:
275+
verb: Get
276+
subject: PrivateStoreAllSubscriptionInTenant
277+
278+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listStopSellOffersPlansNotifications
279+
# - where:
280+
# verb: Get
281+
# subject: PrivateStoreStopSellOfferPlanNotification
282+
# variant: List(?!.*?Expanded)
283+
# remove: true
284+
- where:
285+
verb: Get
286+
subject: PrivateStoreStopSellOfferPlanNotification
287+
remove: true
288+
289+
# /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listSubscriptionsContext
290+
- where:
291+
verb: Get
292+
subject: PrivateStoreSubscriptionContext
293+
set:
294+
subject: PrivateStoreSubscription
167295
```

src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections-offers.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"resourceType": "privateStores/collections/offers",
3-
"apiVersion": "2021-06-01",
3+
"apiVersion": "2023-01-01",
44
"learnMore": {
55
"url": "https://learn.microsoft.com/powershell/module/az.marketplace"
66
},

src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections.json

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"resourceType": "privateStores/collections",
3-
"apiVersion": "2021-06-01",
3+
"apiVersion": "2023-01-01",
44
"learnMore": {
55
"url": "https://learn.microsoft.com/powershell/module/az.marketplace"
66
},
77
"commands": [
88
{
9-
"name": "Copy-AzMarketplacePrivateStoreCollectionOffer",
10-
"description": "transferring offers (copy or move) from source collection to target collection(s)",
11-
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers",
9+
"name": "Disable-AzMarketplacePrivateStoreCollectionAllItem",
10+
"description": "Disable approve all items for the collection.",
11+
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems",
1212
"help": {
1313
"learnMore": {
14-
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/copy-azmarketplaceprivatestorecollectionoffer"
14+
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem"
1515
},
1616
"parameterSets": [
1717
{
@@ -24,7 +24,73 @@
2424
},
2525
"examples": [
2626
{
27-
"description": "transferring offers (copy or move) from source collection to target collection(s)",
27+
"description": "Disable approve all items for the collection.",
28+
"parameters": [
29+
{
30+
"name": "-CollectionId",
31+
"value": "[Path.collectionId]"
32+
},
33+
{
34+
"name": "-PrivateStoreId",
35+
"value": "[Path.privateStoreId]"
36+
}
37+
]
38+
}
39+
]
40+
},
41+
{
42+
"name": "Enable-AzMarketplacePrivateStoreCollectionAllItem",
43+
"description": "Delete all existing offers from the collection and enable approve all items.",
44+
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems",
45+
"help": {
46+
"learnMore": {
47+
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem"
48+
},
49+
"parameterSets": [
50+
{
51+
"parameters": [
52+
"-CollectionId <String>",
53+
"-PrivateStoreId <String>"
54+
]
55+
}
56+
]
57+
},
58+
"examples": [
59+
{
60+
"description": "Delete all existing offers from the collection and enable approve all items.",
61+
"parameters": [
62+
{
63+
"name": "-CollectionId",
64+
"value": "[Path.collectionId]"
65+
},
66+
{
67+
"name": "-PrivateStoreId",
68+
"value": "[Path.privateStoreId]"
69+
}
70+
]
71+
}
72+
]
73+
},
74+
{
75+
"name": "Get-AzMarketplacePrivateStoreCollectionRule",
76+
"description": "Get a list of all private store rules in the given private store and collection",
77+
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules",
78+
"help": {
79+
"learnMore": {
80+
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule"
81+
},
82+
"parameterSets": [
83+
{
84+
"parameters": [
85+
"-CollectionId <String>",
86+
"-PrivateStoreId <String>"
87+
]
88+
}
89+
]
90+
},
91+
"examples": [
92+
{
93+
"description": "Get a list of all private store rules in the given private store and collection",
2894
"parameters": [
2995
{
3096
"name": "-CollectionId",

src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores.json

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"resourceType": "privateStores",
3-
"apiVersion": "2021-06-01",
3+
"apiVersion": "2023-01-01",
44
"learnMore": {
55
"url": "https://learn.microsoft.com/powershell/module/az.marketplace"
66
},
@@ -34,12 +34,12 @@
3434
]
3535
},
3636
{
37-
"name": "Get-AzMarketplaceCollectionToSubscriptionMapping",
38-
"description": "For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.",
39-
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping",
37+
"name": "Get-AzMarketplacePrivateStoreAllSubscriptionInTenant",
38+
"description": "Fetch all subscriptions in tenant, only for marketplace admin",
39+
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant",
4040
"help": {
4141
"learnMore": {
42-
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacecollectiontosubscriptionmapping"
42+
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant"
4343
},
4444
"parameterSets": [
4545
{
@@ -51,7 +51,7 @@
5151
},
5252
"examples": [
5353
{
54-
"description": "For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.",
54+
"description": "Fetch all subscriptions in tenant, only for marketplace admin",
5555
"parameters": [
5656
{
5757
"name": "-PrivateStoreId",
@@ -116,6 +116,34 @@
116116
]
117117
}
118118
]
119+
},
120+
{
121+
"name": "Test-AzMarketplacePrivateStoreAnyExistingOffer",
122+
"description": "Query whether exists any offer in the collections.",
123+
"path": "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections",
124+
"help": {
125+
"learnMore": {
126+
"url": "https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer"
127+
},
128+
"parameterSets": [
129+
{
130+
"parameters": [
131+
"-PrivateStoreId <String>"
132+
]
133+
}
134+
]
135+
},
136+
"examples": [
137+
{
138+
"description": "Query whether exists any offer in the collections.",
139+
"parameters": [
140+
{
141+
"name": "-PrivateStoreId",
142+
"value": "[Path.privateStoreId]"
143+
}
144+
]
145+
}
146+
]
119147
}
120148
]
121149
}

0 commit comments

Comments
 (0)